diff --git a/tournaments/models/team_registration.py b/tournaments/models/team_registration.py index d59781b..f00a144 100644 --- a/tournaments/models/team_registration.py +++ b/tournaments/models/team_registration.py @@ -115,6 +115,14 @@ class TeamRegistration(models.Model): # print("no date") return None + def local_registration_date(self): + timezone = self.tournament.timezone() + if self.registration_date: + return self.registration_date.astimezone(timezone) + else: + # print("no date") + return None + def out_of_tournament(self): return self.walk_out diff --git a/tournaments/repositories.py b/tournaments/repositories.py index 6d621ea..bf296e7 100644 --- a/tournaments/repositories.py +++ b/tournaments/repositories.py @@ -47,9 +47,12 @@ class TournamentRegistrationRepository: rank=rank, computed_rank=computed_rank, licence_id=player_data['licence_id'], - email=team_form_data['email'], - phone_number=team_form_data['mobile_number'] ) + + if is_captain is True: + player_registration.email=team_form_data['email'] + player_registration.phone_number=team_form_data['mobile_number'] + player_registration.save() team_registration.set_weight() diff --git a/tournaments/services/email_service.py b/tournaments/services/email_service.py index ab1ff32..c205e25 100644 --- a/tournaments/services/email_service.py +++ b/tournaments/services/email_service.py @@ -40,7 +40,7 @@ class TournamentEmailService: @staticmethod def _build_email_body(request, tournament, team_registration, tournament_details_str, name_str, waiting_list_position): - inscription_date = timezone.now().strftime("%d/%m/%Y à %H:%M") + inscription_date = team_registration.local_registration_date().strftime("%d/%m/%Y à %H:%M") team_members = [player.name() for player in team_registration.playerregistration_set.all()] team_members_str = " et ".join(team_members) diff --git a/tournaments/services/tournament_registration.py b/tournaments/services/tournament_registration.py index 42bbd88..9176de6 100644 --- a/tournaments/services/tournament_registration.py +++ b/tournaments/services/tournament_registration.py @@ -251,7 +251,9 @@ class TournamentRegistrationService: 'tournament_count': csv_data.get('tournament_count'), 'ligue_name': csv_data.get('ligue_name'), 'club_name': csv_data.get('club_name'), - 'birth_year': csv_data.get('birth_year') + 'birth_year': csv_data.get('birth_year'), + 'email': None, + 'phone': None, }) def _handle_first_tournament_case(self, data): diff --git a/tournaments/templates/tournaments/tournament_info.html b/tournaments/templates/tournaments/tournament_info.html index 583c1ea..49a055f 100644 --- a/tournaments/templates/tournaments/tournament_info.html +++ b/tournaments/templates/tournaments/tournament_info.html @@ -143,7 +143,7 @@
-