-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtemplate.py
81 lines (76 loc) · 2.87 KB
/
template.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Wahoo! Results - https://github.com/JohnStrunk/wahoo-results
# Copyright (C) 2022 - John D. Strunk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""A scoreboard template for previews and theming."""
from raceinfo import HeatData, NumericTime, standard_resolver
def get_template() -> HeatData:
"""
Return template data to create a scoreboard mockup.
>>> from scoreboard import format_time
>>> from raceinfo import NO_SHOW, INCONSISTENT
>>> t = get_template()
>>> t.event
'999'
>>> isinstance(t.lane(1).time(), NumericTime)
True
>>> format_time(t.lane(1).time())
'99:50.99'
>>> t.lane(2).time() == NO_SHOW
True
>>> t.lane(3).time() == INCONSISTENT
True
>>> t.lane(3).name
'Brady, June A'
>>> t.lane(3).team
'TEAM'
"""
basetime = NumericTime("59.99") + NumericTime("60") * NumericTime("99")
lt = [basetime + i - 10 for i in range(1, 11)]
return HeatData(
event="999",
heat=99,
description="GIRLS 15&O 200 MEDLEY RELAY",
lanes=[
HeatData.Lane(
name="Hutchins, Lorraine O",
team="TEAM",
times=[lt[0], lt[0], lt[0]],
),
HeatData.Lane(name="English, Cheryl M", team="TEAM", times=[]),
HeatData.Lane(name="Brady, June A", team="TEAM", times=[NumericTime(1)]),
HeatData.Lane(
name="Sloan, Michelle T", team="TEAM", times=[lt[3], lt[3], lt[3]]
),
HeatData.Lane(
name="Downing, Doreen S", team="TEAM", times=[lt[4], lt[4], lt[4]]
),
HeatData.Lane(
name="Collier, Julie G", team="TEAM", times=[lt[5], lt[5], lt[5]]
),
HeatData.Lane(
name="Chase, Constance H", team="TEAM", times=[lt[6], lt[6], lt[6]]
),
HeatData.Lane(
name="Clark, Leslie J", team="TEAM", times=[lt[7], lt[7], lt[7]]
),
HeatData.Lane(
name="Jensen, Kelli N", team="TEAM", times=[lt[8], lt[8], lt[8]]
),
HeatData.Lane(
name="Parsons, Marsha L", team="TEAM", times=[lt[9], lt[9], lt[9]]
),
],
time_resolver=standard_resolver(2, NumericTime(0.30)),
)