Skip to content

Commit

Permalink
fix: some typing and repr for better debugging of result checking (#429)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandr Karpov <alex.nsk.karpov@gmail.com>
  • Loading branch information
alex-karpov and Aleksandr Karpov committed Jan 21, 2024
1 parent 5559ea6 commit 314ae59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 6 additions & 3 deletions sportorg/models/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from abc import abstractmethod
from datetime import date
from enum import Enum, IntEnum
from typing import Optional
from typing import List, Optional

import dateutil.parser

Expand Down Expand Up @@ -205,7 +205,7 @@ def __init__(self):
self.bib = 0
self.length = 0
self.climb = 0
self.controls = [] # type: List[CourseControl]
self.controls: List[CourseControl] = []

self.count_person = 0
self.count_group = 0
Expand All @@ -215,7 +215,7 @@ def __init__(self):
self.count_finished = 0

def __repr__(self):
return 'Course {}'.format(self.name)
return 'Course {} {}'.format(self.name, repr(self.controls))

def __eq__(self, other):
if len(self.controls) != len(other.controls):
Expand Down Expand Up @@ -388,6 +388,9 @@ def __init__(self):
self.speed = ''
self.length_leg = 0

def __repr__(self) -> str:
return self.code

@property
def time(self):
return self._time
Expand Down
11 changes: 9 additions & 2 deletions sportorg/models/result/result_checker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import logging

from sportorg.common.otime import OTime
from sportorg.models.memory import Person, Result, ResultStatus, find, race
from sportorg.models.memory import (
Person,
Result,
ResultSportident,
ResultStatus,
find,
race,
)


class ResultCheckerException(Exception):
Expand All @@ -12,7 +19,7 @@ class ResultChecker:
def __init__(self, person: Person):
self.person = person

def check_result(self, result):
def check_result(self, result: ResultSportident):
if self.person is None:
return True
if self.person.group is None:
Expand Down

0 comments on commit 314ae59

Please sign in to comment.