Skip to content

Commit 3fc83bd

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

1 file changed

Lines changed: 29 additions & 19 deletions

File tree

othello/apps/games/views.py

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -183,26 +183,32 @@ def queue_json(request: HttpRequest) -> HttpResponse:
183183
paginator = Paginator(matches, 10)
184184
page_number = request.GET.get("page")
185185
page_obj = paginator.get_page(page_number)
186-
186+
187187
matches_data = []
188188
for match in page_obj:
189-
matches_data.append({
190-
"id": match.id,
191-
"player1_name": match.player1.get_game_name(),
192-
"player2_name": match.player2.get_game_name(),
193-
"score": f"{match.player1_wins}-{match.ties}-{match.player2_wins}" if match.status == "completed" else "-",
194-
"is_ranked": "Yes" if match.is_ranked else "No",
195-
"status": match.status,
196-
"created_at": match.created_at.isoformat(),
197-
"can_view_replay": request.user in [match.player1.user, match.player2.user],
198-
})
199-
200-
return JsonResponse({
201-
"matches": matches_data,
202-
"has_next": page_obj.has_next(),
203-
"has_previous": page_obj.has_previous(),
204-
"page_number": page_obj.number,
205-
})
189+
matches_data.append(
190+
{
191+
"id": match.id,
192+
"player1_name": match.player1.get_game_name(),
193+
"player2_name": match.player2.get_game_name(),
194+
"score": f"{match.player1_wins}-{match.ties}-{match.player2_wins}"
195+
if match.status == "completed"
196+
else "-",
197+
"is_ranked": "Yes" if match.is_ranked else "No",
198+
"status": match.status,
199+
"created_at": match.created_at.isoformat(),
200+
"can_view_replay": request.user in [match.player1.user, match.player2.user],
201+
}
202+
)
203+
204+
return JsonResponse(
205+
{
206+
"matches": matches_data,
207+
"has_next": page_obj.has_next(),
208+
"has_previous": page_obj.has_previous(),
209+
"page_number": page_obj.number,
210+
}
211+
)
206212

207213

208214
def queue(request: HttpRequest) -> HttpResponse:
@@ -215,7 +221,11 @@ def queue(request: HttpRequest) -> HttpResponse:
215221
paginator = Paginator(matches, 10)
216222
page_number = request.GET.get("page")
217223
page_obj = paginator.get_page(page_number)
218-
return render(request, "games/queue.html", {"page_obj": page_obj, "my_matches_only": my_matches_only, "request": request})
224+
return render(
225+
request,
226+
"games/queue.html",
227+
{"page_obj": page_obj, "my_matches_only": my_matches_only, "request": request},
228+
)
219229

220230

221231
def watch(request: HttpRequest, game_id: int | None = None) -> HttpResponse:

0 commit comments

Comments
 (0)