Skip to content

Commit c60c0e4

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 1fefc5b commit c60c0e4

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

othello/apps/games/consumers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,12 @@ def send_match_update(self, object_id: int) -> None:
112112
"num_games": match.num_games,
113113
"score": score,
114114
"created_at": match.created_at.isoformat(),
115-
"player1_rating_delta": float(match.player1_rating_delta) if match.player1_rating_delta else None,
116-
"player2_rating_delta": float(match.player2_rating_delta) if match.player2_rating_delta else None,
115+
"player1_rating_delta": float(match.player1_rating_delta)
116+
if match.player1_rating_delta
117+
else None,
118+
"player2_rating_delta": float(match.player2_rating_delta)
119+
if match.player2_rating_delta
120+
else None,
117121
}
118122
)
119123

othello/apps/games/models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,12 @@ class Match(models.Model):
143143
player1_wins = models.IntegerField(default=0)
144144
player2_wins = models.IntegerField(default=0)
145145
ties = models.IntegerField(default=0)
146-
player1_rating_delta = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True)
147-
player2_rating_delta = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True)
146+
player1_rating_delta = models.DecimalField(
147+
max_digits=10, decimal_places=2, null=True, blank=True
148+
)
149+
player2_rating_delta = models.DecimalField(
150+
max_digits=10, decimal_places=2, null=True, blank=True
151+
)
148152

149153
@property
150154
def channels_group_name(self) -> str:

othello/apps/games/views.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,12 @@ def queue_json(request: HttpRequest) -> HttpResponse:
199199
"status_display": match.get_status_display(),
200200
"created_at": match.created_at.isoformat(),
201201
"can_view_replay": request.user in [match.player1.user, match.player2.user],
202-
"player1_rating_delta": float(match.player1_rating_delta) if match.player1_rating_delta else None,
203-
"player2_rating_delta": float(match.player2_rating_delta) if match.player2_rating_delta else None,
202+
"player1_rating_delta": float(match.player1_rating_delta)
203+
if match.player1_rating_delta
204+
else None,
205+
"player2_rating_delta": float(match.player2_rating_delta)
206+
if match.player2_rating_delta
207+
else None,
204208
}
205209
)
206210

0 commit comments

Comments
 (0)