-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify game event template, Implement logic on join event #107
base: main
Are you sure you want to change the base?
Modify game event template, Implement logic on join event #107
Conversation
game.event.template.movYou can take a look at the changes (: |
a76f97e
to
b1b85a9
Compare
cb890cb
to
3fac629
Compare
i think you can reference #41 issue as well |
@@ -51,3 +50,9 @@ def validate_game_event(court, ball_game, min_number_of_players, max_number_of_p | |||
@staticmethod | |||
def is_ball_game_playable_at_court(court, ball_game): | |||
return CourtBallGame.is_ball_game_playable(court, ball_game) | |||
|
|||
def is_event_full(self): | |||
from game_event_player.models import GameEventPlayer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this import to the beginning of the file?
Also in def is_event_time_available(self, desired_event_time)
in player/models.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, It will cause a circular dependency
@@ -3,6 +3,7 @@ | |||
<html> | |||
<head> | |||
<link rel="stylesheet" type="text/css" href="{% static 'css/game-event.css' %}"> | |||
<link rel="stylesheet" type="text/css" href="{% static 'css/game-events.css' %}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see file static/css/game-events.css
in this PR. Perhaps this line is redundant?
@amitkaplansky and @MaayanMashhadi , the video looks awesome! I really like the new features you've added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be better to disable the 'Join Event' button when a player is unable to join the event? Instead of rendering the 'Are you bringing a ball?' message and only then receiving the 'Can't join' error.
<div class="button-container"> | ||
{% if in_event %} | ||
<a href="/game-events/remove-from-event/{{ id }}" class="round-button remove-event-button"> | ||
Remove Event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove event sounds like the event is being removed and not the player-event
Remove Event | |
Leave Event |
</html> | ||
{%endblock%} | ||
{%endblock%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a new line here
is_event_time_available = player.is_event_time_available(event.time) | ||
|
||
error_messages = [] | ||
if is_event_full: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this validation should be on the even page not after we click on the join
@@ -54,3 +55,13 @@ def validate_and_save(self, birth_date, favorite_ball_game): | |||
|
|||
else: | |||
self.save() | |||
|
|||
def is_event_time_available(self, desired_event_time): | |||
from game_event_player.models import GameEventPlayer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move the import no need todo import inside a function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will cause a circular dependency between the player model and the game_event_player
99e5916
to
000a2bc
Compare
Implement logic in join event
000a2bc
to
56bf0c5
Compare
Desired Outcome
Implemented Changes
Added messages error and success to game_event html.
modified join_event, remove_from_event, process_answer_game_event in views.
removed result html
Added is_event_time_available in player model to check if player can join the event.
Added style to game_event css for presenting error and success messages.
Added two tests in
game_event/tests.py
Added two fixtures to conftest.
removed id field from game_event model, added the new migration
0003_alter_gameevent_id.py
, it will be removed after Add player-event linking and event deletion #99 is merged.Connected Issue/Story
Resolves #108
Resolves #109
Resolves #41
Dependencies
Definition of Done
game_event.html
.game_event.html
.Test coverage