fix: [ui:migrateMetaFields] Fixed total number of items displayed

develop-unstable
Sami Mokaddem 2023-02-16 09:42:08 +01:00
parent 27673b54c9
commit 03b6de68e1
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 6 additions and 5 deletions

View File

@ -29,7 +29,7 @@ foreach ($entities as $entity) {
);
}
if ($amountOfEntitiesToUpdate > 10) {
$bodyHtml .= sprintf('<li class="list-inline-item fw-light fs-7">%s</li>', __('{0} more entities', h(10 - $amountOfEntitiesToUpdate)));
$bodyHtml .= sprintf('<li class="list-inline-item fw-light fs-7">%s</li>', __('{0} more entities', $amountOfEntitiesToUpdate - 10));
}
$bodyHtml .= '</ul>';

View File

@ -33,7 +33,7 @@ if (empty($conflictingEntities)) {
'dismissible' => false,
]);
$bodyHtml .= '<ul>';
foreach ($conflictingEntities as $entity) {
foreach ($conflictingEntities as $i => $entity) {
$url = Router::url([
'controller' => 'metaTemplates',
'action' => 'migrateOldMetaTemplateToNewestVersionForEntity',
@ -46,9 +46,10 @@ if (empty($conflictingEntities)) {
__('{0}::{1}', h(Inflector::humanize($oldMetaTemplate->scope)), $entity->id),
__('has {0} meta-fields to update', count($entity->meta_fields))
);
}
if (count($conflictingEntities) > 10) {
$bodyHtml .= sprintf('<li class="list-inline-item fw-light fs-7">%s</li>', __('{0} more entities', h(10 - count($conflictingEntities))));
if ($i >= 9) {
$bodyHtml .= sprintf('<li class="list-inline-item fw-light fs-7">%s</li>', __('{0} more entities', count($conflictingEntities) - 10));
break;
}
}
$bodyHtml .= '</ul>';
}