From f3a12ebda80b06a3b19132e57301d1dba51ab9e1 Mon Sep 17 00:00:00 2001 From: Xu Date: Sun, 25 Feb 2024 15:51:53 +0100 Subject: [PATCH] explain freeloads for users and shicos --- includes/view/ShiftEntry_view.php | 16 +++++++++++++++- includes/view/User_view.php | 22 ++++++++++++++++----- resources/lang/de_DE/default.po | 32 ++++++++++++++++++++++++------- resources/lang/en_US/default.po | 22 +++++++++++++++++++++ 4 files changed, 79 insertions(+), 13 deletions(-) diff --git a/includes/view/ShiftEntry_view.php b/includes/view/ShiftEntry_view.php index d1a34423..ce02337b 100644 --- a/includes/view/ShiftEntry_view.php +++ b/includes/view/ShiftEntry_view.php @@ -1,5 +1,6 @@ ', $freeloaded), form_textarea( 'freeloaded_comment', __('Freeload comment (Only for shift coordination and supporters):'), diff --git a/includes/view/User_view.php b/includes/view/User_view.php index 73794ffd..f650c1ca 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -314,6 +314,7 @@ function User_view_myshift(Shift $shift, $user_source, $its_me) $nightShiftsConfig = config('night_shifts'); $goodie = GoodieType::from(config('goodie_type')); $goodie_enabled = $goodie !== GoodieType::None; + $goodie_tshirt = $goodie === GoodieType::Tshirt; $shift_info = '' . htmlspecialchars($shift->shiftType->name) . ''; if ($shift->title) { @@ -350,16 +351,27 @@ function User_view_myshift(Shift $shift, $user_source, $its_me) } if ($shift->freeloaded) { - $myshift['duration'] = '

' - . sprintf('%.2f', -($shift->end->timestamp - $shift->start->timestamp) / 3600 * 2) . ' h' - . '

'; + $myshift['duration'] = '

' + . sprintf('%.2f', ($shift->end->timestamp - $shift->start->timestamp) / 3600) . ' h' + . '

'; if (auth()->can('user_shifts_admin')) { $myshift['comment'] .= '
' . '

' . __('Freeloaded') . ': ' . htmlspecialchars($shift->freeloaded_comment) . '

'; } else { - $myshift['comment'] .= '

' . __('Freeloaded') . '

'; + if (!$goodie_enabled) { + $freeload_info = __('freeload.info'); + } else { + $freeload_info = __('freeload.info.goodie', [($goodie_tshirt + ? __('T-shirt score') + : __('Goodie score'))]); + } + $myshift['comment'] .= '

' + . __('Freeloaded') + . '

'; } } @@ -986,7 +998,7 @@ function render_user_freeloader_hint() { if (auth()->user()->isFreeloader()) { return sprintf( - __('You freeloaded at least %s shifts. Shift signup is locked. Please go to heavens desk to be unlocked again.'), + __('freeload.freeloader.info'), config('max_freeloadable_shifts') ); } diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index 4397b419..ee259c77 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -1283,13 +1283,6 @@ msgstr "" "Bitte gib Dein geplantes Abreisedatum an, damit wir ein Gefühl für die Abbau-" "Planung bekommen." -msgid "" -"You freeloaded at least %s shifts. Shift signup is locked. Please go to " -"heavens desk to be unlocked again." -msgstr "" -"Du hast mindestens %s Schichten geschwänzt. Schicht-Registrierung ist " -"gesperrt. Bitte gehe zum Himmelsschreibtisch um wieder entsperrt zu werden." - msgid "tshirt.required.hint" msgstr "Bitte gib eine T-Shirt-Größe in deinen Einstellungen an." @@ -2131,3 +2124,28 @@ msgstr "Du kannst dich bis %s Stunden vor dem Start der Schicht austragen. " msgid "Password reset" msgstr "Passwort zurücksetzen" + +msgid "freeload.info.goodie" +msgstr "Du warst bei dieser Schicht nicht anwesend. " +"Die doppelte Länge der Schicht wurde von deinem %s abgezogen. " +"Bitte wende dich bei Fragen an den Himmel." + +msgid "freeload.info" +msgstr "Du warst bei dieser Schicht nicht anwesend. " +"Bitte wende dich bei Fragen an den Himmel." + +msgid "freeload.freeloader.info" +msgstr "" +"Du warst bei mindestens %s Schichten nicht anwesend. Deshalb ist die Schicht-Registrierung " +"gesperrt. Bitte gehe zum Himmel um wieder entsperrt zu werden." + +msgid "freeload.freeloaded.info.goodie" +msgstr "" +"War ein Engel bei einer Schicht nicht anwesend, " +"wird die doppelte Länge der Schicht von dem %s abgezogen. " +"Bei %s geschwänzten Schichten wird die Schicht-Registration für den Engel gesperrt." + +msgid "freeload.freeloaded.info" +msgstr "" +"Der Engel war bei einer Schicht nicht anwesend. " +"Bei %s geschwänzten Schichten wird die Schicht-Registration für den Engel gesperrt." diff --git a/resources/lang/en_US/default.po b/resources/lang/en_US/default.po index 39ee1995..0b8371fc 100644 --- a/resources/lang/en_US/default.po +++ b/resources/lang/en_US/default.po @@ -998,3 +998,25 @@ msgstr "No angeltype has been created yet. Shifts can't be created without one." msgid "shift.sign_out.hint" msgstr "You can self sign out up to %s hours before the start of the shift. " "If you can't attend your shift, ask heaven to sign you out." + +msgid "freeload.info.goodie" +msgstr "You were not present for this shift. " +"The double length of the shift was deducted from your %s. Please contact heaven if you have questions." + +msgid "freeload.info" +msgstr "You were not present for this shift. " +"Please contact heaven if you have questions." + +msgid "freeload.freeloader.info" +msgstr "You were not present for at least %s shifts. Therefore, shift registration is blocked. " +"Please go to heaven to be unlocked again." + +msgid "freeload.freeloaded.info.goodie" +msgstr "" +"If an angel was not present for a shift, the double length of the shift is deducted from the %s. " +"If %s shifts are freeloaded, the shift registration is blocked for the angel." + +msgid "freeload.freeloaded.info" +msgstr "" +"The angel was not present for a shift. " +"If %s shifts are freeloaded, the shift registration is blocked for the angel."