mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-04-25 06:12:38 +00:00
Fix draw issues with translated strings
This commit is contained in:
parent
6d43c4b97e
commit
bc06cf4903
@ -224,7 +224,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
|
|
||||||
# Update user interface
|
# Update user interface
|
||||||
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.start', 'fmt': fmt, 'draw': draw})
|
{'tid': self.tournament_id, 'type': 'draw.start', 'fmt': fmt})
|
||||||
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.set_info',
|
{'tid': self.tournament_id, 'type': 'draw.set_info',
|
||||||
'info': await self.tournament.draw.ainformation()})
|
'info': await self.tournament.draw.ainformation()})
|
||||||
@ -235,7 +235,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.notify',
|
{'tid': self.tournament_id, 'type': 'draw.notify',
|
||||||
'title': 'Tirage au sort du TFJM²',
|
'title': 'Tirage au sort du TFJM²',
|
||||||
'body': _("The draw of tournament {tournament} started!")
|
'body': str(_("The draw of tournament {tournament} started!"))
|
||||||
.format(tournament=self.tournament.name)})
|
.format(tournament=self.tournament.name)})
|
||||||
|
|
||||||
async def draw_start(self, content) -> None:
|
async def draw_start(self, content) -> None:
|
||||||
@ -405,15 +405,15 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
await self.channel_layer.group_send(
|
await self.channel_layer.group_send(
|
||||||
f"team-{dup.participation.team.trigram}",
|
f"team-{dup.participation.team.trigram}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.notify', 'title': 'Tirage au sort du TFJM²',
|
{'tid': self.tournament_id, 'type': 'draw.notify', 'title': 'Tirage au sort du TFJM²',
|
||||||
'body': _("Your dice score is identical to the one of one or multiple teams. "
|
'body': str(_("Your dice score is identical to the one of one or multiple teams. "
|
||||||
"Please relaunch it.")}
|
"Please relaunch it."))}
|
||||||
)
|
)
|
||||||
# Alert the tournament
|
# Alert the tournament
|
||||||
await self.channel_layer.group_send(
|
await self.channel_layer.group_send(
|
||||||
f"tournament-{self.tournament.id}",
|
f"tournament-{self.tournament.id}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.alert',
|
{'tid': self.tournament_id, 'type': 'draw.alert',
|
||||||
'message': _('Dices from teams {teams} are identical. Please relaunch your dices.').format(
|
'message': str(_('Dices from teams {teams} are identical. Please relaunch your dices.').format(
|
||||||
teams=', '.join(td.participation.team.trigram for td in dups)),
|
teams=', '.join(td.participation.team.trigram for td in dups))),
|
||||||
'alert_type': 'warning'})
|
'alert_type': 'warning'})
|
||||||
error = True
|
error = True
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
async for next_round in self.tournament.draw.round_set.filter(number__gte=2).all():
|
async for next_round in self.tournament.draw.round_set.filter(number__gte=2).all():
|
||||||
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.send_poules',
|
{'tid': self.tournament_id, 'type': 'draw.send_poules',
|
||||||
'round': r.number,
|
'round': next_round.number,
|
||||||
'poules': [
|
'poules': [
|
||||||
{
|
{
|
||||||
'letter': pool.get_letter_display(),
|
'letter': pool.get_letter_display(),
|
||||||
@ -612,8 +612,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
# Notify the team that it can draw a problem
|
# Notify the team that it can draw a problem
|
||||||
await self.channel_layer.group_send(f"team-{tds[0].participation.team.trigram}",
|
await self.channel_layer.group_send(f"team-{tds[0].participation.team.trigram}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.notify',
|
{'tid': self.tournament_id, 'type': 'draw.notify',
|
||||||
'title': _("Your turn!"),
|
'title': str(_("Your turn!")),
|
||||||
'body': _("It's your turn to draw a problem!")})
|
'body': str(_("It's your turn to draw a problem!"))})
|
||||||
|
|
||||||
async def select_problem(self, **kwargs):
|
async def select_problem(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
@ -752,8 +752,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
# Notify the team that it can draw a problem
|
# Notify the team that it can draw a problem
|
||||||
await self.channel_layer.group_send(f"team-{new_trigram}",
|
await self.channel_layer.group_send(f"team-{new_trigram}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.notify',
|
{'tid': self.tournament_id, 'type': 'draw.notify',
|
||||||
'title': _("Your turn!"),
|
'title': str(_("Your turn!")),
|
||||||
'body': _("It's your turn to draw a problem!")})
|
'body': str(_("It's your turn to draw a problem!"))})
|
||||||
else:
|
else:
|
||||||
# Pool is ended
|
# Pool is ended
|
||||||
await self.end_pool(pool)
|
await self.end_pool(pool)
|
||||||
@ -829,8 +829,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
# Notify the team that it can draw a dice
|
# Notify the team that it can draw a dice
|
||||||
await self.channel_layer.group_send(f"team-{td.participation.team.trigram}",
|
await self.channel_layer.group_send(f"team-{td.participation.team.trigram}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.notify',
|
{'tid': self.tournament_id, 'type': 'draw.notify',
|
||||||
'title': _("Your turn!"),
|
'title': str(_("Your turn!")),
|
||||||
'body': _("It's your turn to launch the dice!")})
|
'body': str(_("It's your turn to launch the dice!"))})
|
||||||
|
|
||||||
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.dice_visibility',
|
{'tid': self.tournament_id, 'type': 'draw.dice_visibility',
|
||||||
@ -863,8 +863,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
# Notify the team that it can draw a dice
|
# Notify the team that it can draw a dice
|
||||||
await self.channel_layer.group_send(f"team-{participation.team.trigram}",
|
await self.channel_layer.group_send(f"team-{participation.team.trigram}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.notify',
|
{'tid': self.tournament_id, 'type': 'draw.notify',
|
||||||
'title': _("Your turn!"),
|
'title': str(_("Your turn!")),
|
||||||
'body': _("It's your turn to launch the dice!")})
|
'body': str(_("It's your turn to launch the dice!"))})
|
||||||
|
|
||||||
# Reorder dices
|
# Reorder dices
|
||||||
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
||||||
@ -988,8 +988,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
# Notify the team that it can draw a problem
|
# Notify the team that it can draw a problem
|
||||||
await self.channel_layer.group_send(f"team-{new_trigram}",
|
await self.channel_layer.group_send(f"team-{new_trigram}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.notify',
|
{'tid': self.tournament_id, 'type': 'draw.notify',
|
||||||
'title': _("Your turn!"),
|
'title': str(_("Your turn!")),
|
||||||
'body': _("It's your turn to draw a problem!")})
|
'body': str(_("It's your turn to draw a problem!"))})
|
||||||
|
|
||||||
@ensure_orga
|
@ensure_orga
|
||||||
async def export(self, **kwargs):
|
async def export(self, **kwargs):
|
||||||
@ -1039,7 +1039,7 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
# Send notification to everyone
|
# Send notification to everyone
|
||||||
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.notify',
|
{'tid': self.tournament_id, 'type': 'draw.notify',
|
||||||
'title': _("Draw") + " " + settings.APP_NAME,
|
'title': str(_("Draw")) + " " + settings.APP_NAME,
|
||||||
'body': str(_("The draw of the second round is starting!"))})
|
'body': str(_("The draw of the second round is starting!"))})
|
||||||
|
|
||||||
if settings.TFJM_APP == "TFJM":
|
if settings.TFJM_APP == "TFJM":
|
||||||
@ -1092,8 +1092,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
# Notify the team that it can draw a problem
|
# Notify the team that it can draw a problem
|
||||||
await self.channel_layer.group_send(f"team-{td.participation.team.trigram}",
|
await self.channel_layer.group_send(f"team-{td.participation.team.trigram}",
|
||||||
{'tid': self.tournament_id, 'type': 'draw.notify',
|
{'tid': self.tournament_id, 'type': 'draw.notify',
|
||||||
'title': _("Your turn!"),
|
'title': str(_("Your turn!")),
|
||||||
'body': _("It's your turn to draw a problem!")})
|
'body': str(_("It's your turn to draw a problem!"))})
|
||||||
else:
|
else:
|
||||||
async for td in r2.team_draws.prefetch_related('participation__team'):
|
async for td in r2.team_draws.prefetch_related('participation__team'):
|
||||||
await self.channel_layer.group_send(f"team-{td.participation.team.trigram}",
|
await self.channel_layer.group_send(f"team-{td.participation.team.trigram}",
|
||||||
|
@ -221,9 +221,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
elem.innerText = `${trigram} 🎲 ${result}`
|
elem.innerText = `${trigram} 🎲 ${result}`
|
||||||
}
|
}
|
||||||
|
|
||||||
let nextTeam = document.querySelector(` div[id="dices-${tid}"] > div > div[class*="text-bg-warning"]`).getAttribute("data-team")
|
let nextTeamDiv = document.querySelector(` div[id="dices-${tid}"] > div > div[class*="text-bg-warning"]`)
|
||||||
if (nextTeam) {
|
if (nextTeamDiv) {
|
||||||
// If there is one team that does not have launched its dice, then we update the debug section
|
// If there is one team that does not have launched its dice, then we update the debug section
|
||||||
|
let nextTeam = nextTeamDiv.getAttribute("data-team")
|
||||||
let debugSpan = document.getElementById(`debug-dice-${tid}-team`)
|
let debugSpan = document.getElementById(`debug-dice-${tid}-team`)
|
||||||
if (debugSpan)
|
if (debugSpan)
|
||||||
debugSpan.innerText = nextTeam
|
debugSpan.innerText = nextTeam
|
||||||
|
Loading…
x
Reference in New Issue
Block a user