Skip to content

Commit 01252dd

Browse files
committed
change pirate round progress bar
1 parent daa6e61 commit 01252dd

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

src/Module/Database/View/ShowPirateRound/ShowPirateRound.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ public function handle(GameControllerInterface $game): void
8383
}
8484
}
8585
}
86+
$maxPrestige = $lastRound->getMaxPrestige() ?? 0;
87+
$actualPrestige = $lastRound->getActualPrestige() ?? 0;
88+
$remainingPrestige = max(0, $maxPrestige - $actualPrestige);
8689

90+
$game->setTemplateVar('REMAINING_PRESTIGE', $remainingPrestige);
8791
$game->setTemplateVar('WINNER_FACTION_SHIPS', $winnerFactionShips);
8892
$game->setTemplateVar('PIRATE_ROUND', $lastRound);
8993
$game->setTemplateVar('TOP_USERS', $topList);

src/Public/static/js/database.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ function initializeSpacyProgressBar(maxPrestige, actualPrestige) {
317317

318318
if (!progressBar || !progressText || !progressContainer) return;
319319

320-
const percentage = maxPrestige > 0 ? (actualPrestige / maxPrestige) * 100 : 0;
320+
const percentage = ((maxPrestige - actualPrestige) / maxPrestige) * 100;
321321

322322
let gradient, glowColor;
323323
if (percentage >= 75) {

src/html/database/pirateRound.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<div id="factionChart" data-factions="{{ FACTION_DATA|json_encode|e('html_attr') }}"
6666
data-max-prestige="{{ PIRATE_ROUND.getMaxPrestige|default(0) }}"
6767
data-actual-prestige="{{ PIRATE_ROUND.getActualPrestige|default(0) }}"
68+
data-remaining-prestige="{{ REMAINING_PRESTIGE|default(0) }}"
6869
style="width: 400px; height: 400px; margin: 0 auto; position: relative;">
6970
<div id="chartFrame" style="
7071
position: absolute; top: 0; left: 0; width: 100%; height: 100%;

tests/inttest/html/__snapshots__/AllViewControllerTest--DATABASE_VIEWS-SHOW_PIRATE_ROUND.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ <h1>Piraten-Runde</h1>
9393
<div class="box" style="margin-bottom: 20px;">
9494
<div class="box_title">Fraktions-Verteilung</div>
9595
<div class="box_body" style="padding: 20px;">
96-
<div id="factionChart" data-factions='[{"id":3,"name":"Klingonisches Imperium","color":"#990000","prestige":370,"ships":17,"percentage":78.72340425531915,"rank":1},{"id":1,"name":"Vereinte F\u00f6deration der Planeten","color":"#000099","prestige":100,"ships":5,"percentage":21.27659574468085,"rank":2}]' data-max-prestige="10000" data-actual-prestige="470" style="width: 400px; height: 400px; margin: 0 auto; position: relative;">
96+
<div id="factionChart" data-factions='[{"id":3,"name":"Klingonisches Imperium","color":"#990000","prestige":370,"ships":17,"percentage":78.72340425531915,"rank":1},{"id":1,"name":"Vereinte F\u00f6deration der Planeten","color":"#000099","prestige":100,"ships":5,"percentage":21.27659574468085,"rank":2}]' data-max-prestige="10000" data-actual-prestige="470" data-remaining-prestige="9530" style="width: 400px; height: 400px; margin: 0 auto; position: relative;">
9797
<div id="chartFrame" style="
9898
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
9999
border: 2px solid #00ffff; border-radius: 50%;

0 commit comments

Comments
 (0)