style(session): apply ruff format to issue #53 changes
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+4
-11
@@ -49,16 +49,12 @@ class SessionRowData(TypedDict):
|
|||||||
cell_data: list[Node]
|
cell_data: list[Node]
|
||||||
|
|
||||||
|
|
||||||
def session_row_data(
|
def session_row_data(session: Session, device_list, csrf_token: str) -> SessionRowData:
|
||||||
session: Session, device_list, csrf_token: str
|
|
||||||
) -> SessionRowData:
|
|
||||||
"""Canonical session-list row. Single source of truth shared by
|
"""Canonical session-list row. Single source of truth shared by
|
||||||
list_sessions and the htmx finish/reset fragments."""
|
list_sessions and the htmx finish/reset fragments."""
|
||||||
row_selector = f"#session-row-{session.pk}"
|
row_selector = f"#session-row-{session.pk}"
|
||||||
end_url = reverse("games:list_sessions_end_session", args=[session.pk])
|
end_url = reverse("games:list_sessions_end_session", args=[session.pk])
|
||||||
reset_url = reverse(
|
reset_url = reverse("games:list_sessions_reset_session_start", args=[session.pk])
|
||||||
"games:list_sessions_reset_session_start", args=[session.pk]
|
|
||||||
)
|
|
||||||
actions = ButtonGroup(
|
actions = ButtonGroup(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -202,8 +198,7 @@ def list_sessions(request: HttpRequest, search_string: str = "") -> HttpResponse
|
|||||||
"Actions",
|
"Actions",
|
||||||
],
|
],
|
||||||
"rows": [
|
"rows": [
|
||||||
session_row_data(session, device_list, csrf_token)
|
session_row_data(session, device_list, csrf_token) for session in sessions
|
||||||
for session in sessions
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
content = paginated_table_content(
|
content = paginated_table_content(
|
||||||
@@ -313,9 +308,7 @@ def _row_with_navbar(request: HttpRequest, session: Session) -> HttpResponse:
|
|||||||
counts = model_counts(request)
|
counts = model_counts(request)
|
||||||
fragment = Fragment(
|
fragment = Fragment(
|
||||||
session_row(session, device_list, get_token(request)),
|
session_row(session, device_list, get_token(request)),
|
||||||
NavbarPlaytime(
|
NavbarPlaytime(counts["today_played"], counts["last_7_played"], oob=True),
|
||||||
counts["today_played"], counts["last_7_played"], oob=True
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
return HttpResponse(str(fragment))
|
return HttpResponse(str(fragment))
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class RenderedPagesTest(TestCase):
|
|||||||
self.assertIn("submit_and_redirect", html)
|
self.assertIn("submit_and_redirect", html)
|
||||||
self.assertIn("Submit & Create Purchase", html) # & correctly escaped
|
self.assertIn("Submit & Create Purchase", html) # & correctly escaped
|
||||||
self.assertIn("submit_and_create_session", html)
|
self.assertIn("submit_and_create_session", html)
|
||||||
self.assertIn("Submit & Create Session", html) # & correctly escaped
|
self.assertIn("Submit & Create Session", html) # & correctly escaped
|
||||||
# Fields self-style: label + control carry their own classes (no #add-form
|
# Fields self-style: label + control carry their own classes (no #add-form
|
||||||
# / form CSS in input.css).
|
# / form CSS in input.css).
|
||||||
self.assertIn("mb-2.5 text-sm font-medium text-heading", html) # _LABEL_CLASS
|
self.assertIn("mb-2.5 text-sm font-medium text-heading", html) # _LABEL_CLASS
|
||||||
|
|||||||
@@ -38,9 +38,7 @@ def test_reset_session_start_htmx_returns_row_no_refresh_header(
|
|||||||
auth_client, running_session
|
auth_client, running_session
|
||||||
):
|
):
|
||||||
original_start = running_session.timestamp_start
|
original_start = running_session.timestamp_start
|
||||||
url = reverse(
|
url = reverse("games:list_sessions_reset_session_start", args=[running_session.pk])
|
||||||
"games:list_sessions_reset_session_start", args=[running_session.pk]
|
|
||||||
)
|
|
||||||
response = auth_client.get(url, HTTP_HX_REQUEST="true")
|
response = auth_client.get(url, HTTP_HX_REQUEST="true")
|
||||||
body = response.content.decode()
|
body = response.content.decode()
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|||||||
Reference in New Issue
Block a user