Skip to content

Commit f1bef17

Browse files
committed
CHANGES:
- GreenieBoard: New layout added (auto migration)
1 parent 7df38f4 commit f1bef17

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

plugins/greenieboard/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"--": {"rating": 2, "grade": "No grade. Below average corrections but safe pass", "color": "#73481d", "legend": "NO GRADE"},
77
"WO": {"rating": 1, "grade": "Wave-off", "color": "#000000", "legend": "WAVE OFF"},
88
"C": {"rating": 0, "grade": "Cut. Unsafe, gross deviations inside the wave-off window", "color": "#CC0000", "legend": "CUT"},
9+
"NC": {"rating": 0, "grade": "No count", "color": "#FFFFFF", "legend": "NO COUNT"},
910
"_n": {"color": "#000000", "legend": "Night pass"}
1011
}
1112

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
UPDATE traps SET grade = 'NC' WHERE grade IN ('WOP', 'OWO', 'TWO', 'TLU');

plugins/greenieboard/listener.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,14 @@ async def onMissionLoadEnd(self, server: Server, _: dict) -> None:
127127
async def process_lso_event(self, config: dict, server: Server, player: Player, data: dict):
128128
time = (int(server.current_mission.start_time) + int(data['time'])) % 86400
129129
night = time > 20 * 3600 or time < 6 * 3600
130-
points = int(data.get('points', config['ratings'].get(data['grade'], 0)))
130+
points = int(data.get('points', config['grades'].get(data['grade'], {}).get('rating', 0)))
131+
# map some events to NC
132+
if data['grade'] in ['WOP', 'OWO', 'TWO', 'TLU']:
133+
data['grade'] = 'NC'
131134
# Moose.AIRBOSS sometimes gives negative points for WO. That is not according to any standard.
132135
# After SME consultation, any WO will give the WO points (typically 1.0).
133-
if points < 0 and 'WO' in data['grade']:
134-
points = config['ratings']['WO']
136+
if points < 0 and data['grade'] == 'WO':
137+
points = config['grades']['WO']['rating']
135138
if config.get('credits', False):
136139
cp: CreditPlayer = cast(CreditPlayer, player)
137140
cp.audit(_('Carrier Landing'), cp.points,

plugins/greenieboard/reports.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ async def render(self, server_name: str, num_rows: int, num_landings: int, squad
311311
font_name = None
312312

313313
# Calculate dynamic figure size based on rows and columns
314-
pilot_column_width = max([len(item['name']) for item in rows]) * 0.20
314+
pilot_column_width = (max([len(item['name']) for item in rows]) if rows else 1) * 0.20
315315
padding = 1.0 # Padding between columns
316316
fig_width = pilot_column_width + padding + (num_columns * column_width) + 2 # Additional padding on the sides
317317
fig_height = (num_rows * row_height) + 2 + 2.5 # Additional padding on the top and bottom
@@ -363,6 +363,9 @@ async def render(self, server_name: str, num_rows: int, num_landings: int, squad
363363
if j < len(landings):
364364
grade = landings[j]['grade']
365365

366+
if grade in ['WOP', 'OWO', 'TWO', 'TLU']:
367+
grade = 'NC'
368+
366369
if grade == '_OK_':
367370
imagebox = OffsetImage(unicorn_image, zoom=1, resample=True)
368371
ab = AnnotationBbox(imagebox, (x_pos + card_size / 2, y_position), frameon=False, zorder=3)

plugins/greenieboard/schemas/greenieboard_schema.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ schema;default_schema:
2020
type: map
2121
nullable: false
2222
mapping:
23-
regex;(\_OK\_|OK|\(OK\)|B|\-\-|WO|C|_n):
23+
regex;(\_OK\_|OK|\(OK\)|B|\-\-|WO|C|NC|_n):
2424
type: map
2525
nullable: false
2626
mapping:

0 commit comments

Comments
 (0)