Skip to content

Commit

Permalink
feat: support of loading ResultSrpid objects from JSON (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeikobelev committed Dec 18, 2023
1 parent c040f87 commit 4f36e83
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sportorg/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,16 @@ def teamwork(self, command):
race().update_data(command.data)
# logging.info(repr(command.data))
# if 'object' in command.data and command.data['object'] in
# ['ResultManual', 'ResultSportident', 'ResultSFR', 'ResultSportiduino']:

# ['ResultManual', 'ResultSportident', 'ResultSFR', 'ResultSportiduino' etc.]:
if command.header.obj_type in [
ObjectTypes.Result.value,
ObjectTypes.ResultManual.value,
ObjectTypes.ResultSportident.value,
ObjectTypes.ResultSFR.value,
ObjectTypes.ResultSportiduino.value,
ObjectTypes.ResultSrpid.value,
ObjectTypes.ResultRfidImpinj.value,
]:
self.deleyed_res_recalculate(1000)
Broker().produce('teamwork_recieving', command.data)
Expand Down
3 changes: 3 additions & 0 deletions sportorg/models/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,7 @@ class Race(Model):
'ResultSFR': ResultSFR,
'ResultSportiduino': ResultSportiduino,
'ResultRfidImpinj': ResultRfidImpinj,
'ResultSrpid': ResultSrpid,
'Group': Group,
'Course': Course,
'Organization': Organization,
Expand Down Expand Up @@ -1424,6 +1425,7 @@ def list_obj(self):
'ResultSFR': self.results,
'ResultSportiduino': self.results,
'ResultRfidImpinj': self.results,
'ResultSrpid': self.results,
'Group': self.groups,
'Course': self.courses,
'Organization': self.organizations,
Expand Down Expand Up @@ -1568,6 +1570,7 @@ def update_obj(self, obj, dict_obj):
'ResultSFR',
'ResultSportiduino',
'ResultRfidImpinj',
'ResultSrpid',
]:
obj.person = self.get_obj('Person', dict_obj['person_id'])
elif dict_obj['object'] == 'Group':
Expand Down
3 changes: 3 additions & 0 deletions sportorg/modules/live/orgeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ async def create(url, data, race_data, log, *, session):
'ResultSFR',
'ResultManual',
'ResultRfidImpinj',
'ResultSrpid',
]:
person_data = _get_person(item, race_data)
if person_data:
Expand Down Expand Up @@ -253,6 +254,7 @@ async def create_online_cp(url, data, race_data, log, *, session):
'ResultSFR',
'ResultManual',
'ResultRfidImpinj',
'ResultSrpid',
]:
try:
res = _get_result_by_id(item, race_data)
Expand Down Expand Up @@ -322,6 +324,7 @@ async def delete(url, data, race_data, log, *, session):
'ResultSFR',
'ResultManual',
'ResultRfidImpinj',
'ResultSrpid',
]:
person_data = _get_person(item, race_data)
if person_data:
Expand Down
2 changes: 2 additions & 0 deletions sportorg/modules/teamwork/packet_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class ObjectTypes(Enum):
ResultSportident = 7
ResultSFR = 8
ResultSportiduino = 9
ResultRfidImpinj = 10
ResultSrpid = 11
Unknown = 255

def __str__(self):
Expand Down

0 comments on commit 4f36e83

Please sign in to comment.