From 6f22614d8c68c68c88b44804802cdffeb3c6a3c7 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Mon, 11 Apr 2022 16:29:02 +0200 Subject: [PATCH] small fixes --- app/Models/Protocol.php | 2 +- resources/js/components/protocol/Item.js | 15 ++++++++++++++- resources/js/i18n/de.js | 3 ++- resources/js/i18n/en.js | 5 +++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/Models/Protocol.php b/app/Models/Protocol.php index 7a90851..1214de6 100644 --- a/app/Models/Protocol.php +++ b/app/Models/Protocol.php @@ -110,7 +110,7 @@ class Protocol extends Model $protocol = static::create([ 'tournament_id' => $tournament->id, 'user_id' => $user->id, - 'type' => 'round.create', + 'type' => 'round.seed', 'details' => [ 'tournament' => static::tournamentMemo($tournament), 'round' => static::roundMemo($round), diff --git a/resources/js/components/protocol/Item.js b/resources/js/components/protocol/Item.js index 9fcc7e5..18b04cc 100644 --- a/resources/js/components/protocol/Item.js +++ b/resources/js/components/protocol/Item.js @@ -25,6 +25,13 @@ const getEntryDetailsUsername = entry => { const getEntryRoundNumber = entry => (entry && entry.details && entry.details.round && entry.details.round.number) || '?'; +const getEntryResultComment = entry => { + if (!entry || !entry.details || !entry.details.result || !entry.details.result.comment) { + return ''; + } + return entry.details.result.comment; +}; + const getEntryResultTime = entry => { if (!entry || !entry.details || !entry.details.result) return 'ERROR'; const result = entry.details.result; @@ -44,6 +51,12 @@ const getEntryDescription = entry => { username: getEntryDetailsUsername(entry), }, ); + case 'result.comment': { + const comment = getEntryResultComment(entry); + return + {{comment}}, + ; + } case 'result.report': { const time = getEntryResultTime(entry); return @@ -52,6 +65,7 @@ const getEntryDescription = entry => { } case 'round.create': case 'round.lock': + case 'round.seed': case 'round.unlock': return i18n.t( `protocol.description.${entry.type}`, @@ -60,7 +74,6 @@ const getEntryDescription = entry => { number: getEntryRoundNumber(entry), }, ); - case 'result.comment': case 'tournament.lock': return i18n.t( `protocol.description.${entry.type}`, diff --git a/resources/js/i18n/de.js b/resources/js/i18n/de.js index cc98394..92c64f6 100644 --- a/resources/js/i18n/de.js +++ b/resources/js/i18n/de.js @@ -139,12 +139,13 @@ export default { rejected: 'Anmeldung von {{username}} abgelehnt', }, result: { - comment: 'Ergebnis kommentiert: "{{details.result.comment}}"', + comment: 'Ergebnis kommentiert: <0>{{comment}}', report: 'Ergebnis von <0>{{time}} eingetragen', }, round: { create: 'Runde #{{number}} hinzugefügt', lock: 'Runde #{{number}} gesperrt', + seed: 'Seed für Runde #{{number}} eingetragen', unlock: 'Runde #{{number}} entsperrt', }, tournament: { diff --git a/resources/js/i18n/en.js b/resources/js/i18n/en.js index cd6dea0..b361c68 100644 --- a/resources/js/i18n/en.js +++ b/resources/js/i18n/en.js @@ -139,12 +139,13 @@ export default { rejected: 'Application from {{username}} rejected', }, result: { - comment: 'Result commented: "{{details.result.comment}}"', - report: 'Result of {{time}} reported', + comment: 'Result commented: <0>{{comment}}', + report: 'Result of <0>{{time}} reported', }, round: { create: 'Round #{{number}} added', lock: 'Round #{{number}} locked', + seed: 'Set seed for round #{{number}}', unlock: 'Round #{{number}} unlocked', }, tournament: { -- 2.39.2