Skip to content

Commit

Permalink
fixup! refactor: add if_present utility
Browse files Browse the repository at this point in the history
  • Loading branch information
mtth committed May 19, 2024
1 parent 1598597 commit 930e7bb
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions opvious/data/queued_solves.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ class QueuedSolve:
uuid: Uuid
"""The solve's unique identifier"""

annotations: list[Annotation]
"""Annotation metadata"""

outcome: Optional[SolveOutcome]
"""Final solve outcome, if available"""

enqueued_at: datetime
"""The time the solve was created"""

Expand All @@ -41,19 +47,20 @@ class QueuedSolve:
completed_at: Optional[datetime]
"""The time the solve completed"""

annotations: list[Annotation]
"""Annotation metadata"""

outcome: Optional[SolveOutcome]
"""Final solve outcome, if available"""

problem_summary: Optional[ProblemSummary] = dataclasses.field(repr=False)
"""Summary information about the solved problem"""

options: Json = dataclasses.field(repr=False)
transformations: Json = dataclasses.field(repr=False)
strategy: Json = dataclasses.field(repr=False)

@property
def duration(self) -> Optional[datetime.timedelta]:
"""The solve's runtime, if it is complete"""
return (
self.completed_at - self.enqueued_at if self.completed_at else None
)


def queued_solve_from_graphql(
data: Json, attempt_data: Optional[Json] = None
Expand Down

0 comments on commit 930e7bb

Please sign in to comment.