Clean up ruff E701 warnings

Split multi-statement-on-one-line colon constructs in crud_scene.py
and routes_scene.py onto separate lines.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-14 09:00:44 -07:00
parent 3bb4940df7
commit f40724c9d2
3 changed files with 58 additions and 12 deletions

43
TODO.md
View File

@@ -1,11 +1,35 @@
## Major features
- [x] **Rollback of game state.** Full-state JSON snapshots in a `Checkpoint` table, captured per action by the broadcast middleware, restored by `crud_rollback.rollback_to_checkpoint`; scene-confined; server-enforced for Admins and Deep players. Rolling back is non-destructive — it moves a head pointer (`Game.rollback_head_checkpoint_id`), so later log entries grey out and can be redone (roll forward); the abandoned future is only discarded when a new action is taken. UI is the per-event rollback/redo buttons + greyed entries + "rolled back" banner in `EventLog.svelte`.
## Polish
- [x] **Clean up ruff E701 warnings**
- [ ] **Modal name popup**. When a Pi-Rat gains a name, they get a modal popup they have to fill out before continuing, rather than an optional box on their character sheet
- [ ] **Cancel Revise**. In character creation, if you click "Revise" and then don't want to make any changes after all, there should be a cancel button that throws away any edits you've made since you clicked revise.
- [ ] **Teaching mode**. The creator/admin should have an option to seed themselves as the player who is forced to be the Deep for the first scene
- [ ] Visual feedback confirming hand refresh in Deep Upkeep
- [ ] On the screen after pirat rank up voting, it should display the winner
- [ ] When Deep issues a challenge, stakes should be two fields, success and failure
- [ ] Captain should not be autoassigned. That's something the crew has to earn.
- [ ] The back button on the admin page should go back to the active game, not the join screen
- [ ] Add a toast pop-up for new events entering the event log, that then fades into the event log button
- [ ] When you get a gat, there should be a pop up to enter a description of it, as with your name
- [ ] In between scenes, there really only needs to be one panel with the roster and voting status. There doesn't need to be a whole extra panel to inform players that the deep will later get to refresh their hands.
## Words Words Words
- [ ] **Example Play formatting.** The Example Play section of the Rules page could use a bit more formatting for legibility. Make diagrams of the card state at each step rather than just a text listing.
- [ ] **Suggestions.** Take a pass through all of the suggestions in suggestions.js, rewrite ones that are stiff, awkward, or don't fit the theme/setting as described in the rulebook. Move the suggestion pool from suggestions.js into a backend API endpoint.
- [ ] **TLDR rules**. A one page summary sheet of the rulebook, for the impatient
- [ ] **Version number and change log**
## Security
@@ -14,4 +38,17 @@
## Cleanup
- [ ] **Look for dead code.** While implementing the rollback feature, we discovered /scene/rollback, an unused and buggy single-card-play rollback route that was added but never hooked up to the UI. Look for other code that matches that pattern -- orphan functions and routes that never get called.
- [ ] **Clean up ruff E701 warnings**
- [ ] **Scene dashboard design refresh.** There should be a column of bubbles/buttons to the left of the obstacle list panel. These represent the crew. You can click a Pi-Rat to pop out their character sheet. If the other player is a Pi-Rat in the scene, there's the "challenge them" UI, which no longer needs the "Challenge whom?" since it's tied to a particular character sheet. Finally, there's the personal objective list. There's also an objectives button (at the top level of the hierarchy) which shows a popup for crew objectives. This entirely replaces the character sheet panel on the current dashboard, as well as the roster at the top of the obstacle list. The captain has a steering wheel emoji next to them. The display should also show current hand size for all players.
- [ ] **Make card tooltips more graphical** Rather than just being an HTML title attribute, they should be a nicely formatted pop-up UI element. There should also be tooltips in the challenge/obstacle box card displays, and these should describe the card, not the event of it being played, since that's covered by the event log.
- [ ] **Add card tooltips to more things**. They need to be in the challenge UI and resting deep phase.
- [ ] **Make the color of challenges more clear**. Right now there are all sorts of highlights around the challenge box, and it's not clear if red or black is the "good" color to play on it. Also, double check the rulebook about whether the color of the challenge is based on the original card or the latest card played.
- [ ] Interaction during a challenge should be promoted to the top of the UI
- [ ] Event log should be a top level panel, not an overlay.

View File

@@ -307,7 +307,8 @@ def toggle_objective(db: Session, game_id: str, target_id: str, obj_type: str, s
"""Toggles Personal or Crew objectives and adjusts states/Ranks/Captaincy accordingly."""
if obj_type.startswith("crew_"):
game = get_game(db, game_id)
if not game: return
if not game:
return
if obj_type == "crew_1":
game.completed_crew_1 = status
db.add(game)

View File

@@ -89,19 +89,27 @@ def toggle_objective_route(
):
if type.startswith("crew_"):
game = crud.get_game(db, game_id)
if not game: raise HTTPException(status_code=404)
if not game:
raise HTTPException(status_code=404)
current_status = False
if type == "crew_1": current_status = game.completed_crew_1
elif type == "crew_2": current_status = game.completed_crew_2
elif type == "crew_3": current_status = game.completed_crew_3
if type == "crew_1":
current_status = game.completed_crew_1
elif type == "crew_2":
current_status = game.completed_crew_2
elif type == "crew_3":
current_status = game.completed_crew_3
crud.toggle_objective(db, game_id, player_id, type, not current_status)
else:
player = crud.get_player(db, player_id)
if not player: raise HTTPException(status_code=404, detail="Player not found")
if not player:
raise HTTPException(status_code=404, detail="Player not found")
current_status = False
if type == "personal_1": current_status = player.completed_personal_1
elif type == "personal_2": current_status = player.completed_personal_2
elif type == "personal_3": current_status = player.completed_personal_3
if type == "personal_1":
current_status = player.completed_personal_1
elif type == "personal_2":
current_status = player.completed_personal_2
elif type == "personal_3":
current_status = player.completed_personal_3
crud.toggle_objective(db, game_id, player_id, type, not current_status)
return {"status": "ok"}