diff --git a/templates/board/_spot.html.twig b/templates/board/_spot.html.twig
index bf0f198..ca63be2 100644
--- a/templates/board/_spot.html.twig
+++ b/templates/board/_spot.html.twig
@@ -45,9 +45,10 @@
{% if booking.user.id == app.user.id %}
{% set who = 'du' %}
{% else %}
- {# "Anna Berger" -> "Anna B." : keeps a card on one line per booking at phone width. #}
+ {# "Anna Berger" -> "A. Berger" : keeps a card on one line per booking at phone width,
+ and the surname tells two Annas apart where the initial would not. #}
{% set parts = booking.user.name|split(' ')|filter(part => part is not empty) %}
- {% set who = parts|length > 1 ? parts|first ~ ' ' ~ parts|last|slice(0, 1) ~ '.' : booking.user.name %}
+ {% set who = parts|length > 1 ? parts|first|slice(0, 1) ~ '. ' ~ parts|last : booking.user.name %}
{% endif %}
{% set lines = lines|merge([who ~ (booking.timeRange.allDay ? '' : ' ' ~ booking.timeRange)]) %}
{% endfor %}
diff --git a/tests/Controller/FloorPlanTest.php b/tests/Controller/FloorPlanTest.php
index 2504698..49d1427 100644
--- a/tests/Controller/FloorPlanTest.php
+++ b/tests/Controller/FloorPlanTest.php
@@ -56,20 +56,21 @@ class FloorPlanTest extends WebTestCase
$this->book($desk, $this->user('bea@ep-reisen.de', 'Bea Kranz'), 540, 780);
self::assertSame(
- ['Schreibtisch 01', 'Bea K. 09:00–13:00', 'frei ab 13:00'],
+ ['Schreibtisch 01', 'B. Kranz 09:00–13:00', 'frei ab 13:00'],
$this->linesOf($this->board()),
);
}
/**
- * Full names are shortened so a card stays one line per booking at phone width.
+ * Full names are shortened so a card stays one line per booking at phone width. The surname
+ * survives, not the first name, so two colleagues sharing a first name stay distinguishable.
*/
- public function testALongNameIsShortenedToAFirstNameAndInitial(): void
+ public function testALongNameIsShortenedToAnInitialAndTheSurname(): void
{
$desk = $this->desk();
$this->book($desk, $this->user('x@ep-reisen.de', 'Maximilian Wolkenstein'), 0, 1440);
- self::assertContains('Maximilian W.', $this->linesOf($this->board()));
+ self::assertContains('M. Wolkenstein', $this->linesOf($this->board()));
}
public function testASingleWordNameIsLeftAlone(): void
@@ -94,7 +95,7 @@ class FloorPlanTest extends WebTestCase
$desk = $this->desk();
$this->book($desk, $this->user('bea@ep-reisen.de', 'Bea Kranz'), 0, 1440);
- self::assertSame(['Schreibtisch 01', 'Bea K.'], $this->linesOf($this->board()));
+ self::assertSame(['Schreibtisch 01', 'B. Kranz'], $this->linesOf($this->board()));
}
/**
@@ -112,7 +113,7 @@ class FloorPlanTest extends WebTestCase
$lines = $this->linesOf($this->board());
self::assertSame(
- ['Schreibtisch 01', 'Ann A. bis 06:00', 'Bea B. 06:00–12:00', '+2 weitere'],
+ ['Schreibtisch 01', 'A. Alpha bis 06:00', 'B. Beta 06:00–12:00', '+2 weitere'],
$lines,
);
// Label plus MAX_LINES, never more.