Pass start FEN and game data to the board analyser, load board.css, drop the status dot

This commit is contained in:
claude committed 2026-10-10 16:02:29 +02:00
1 parent 309754bb08
commit 611a117a38
3 files changed
+15 -1

No files matched your search

+14
View File
@@ -26,6 +26,8 @@ STC_MAX_BASE_SECONDS = 30
BUCKETS = ('STC', 'LTC', 'OTHER') BUCKETS = ('STC', 'LTC', 'OTHER')
START_FEN = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1'
@lru_cache(maxsize=512) @lru_cache(maxsize=512)
def classify_time_control(time_control): def classify_time_control(time_control):
@@ -276,6 +278,9 @@ def parse_pgn(text):
'date' : header_map.get('Date', ''), 'date' : header_map.get('Date', ''),
'duration' : header_map.get('GameDuration', ''), 'duration' : header_map.get('GameDuration', ''),
'fen' : fen, 'fen' : fen,
'start_fen' : fen or START_FEN,
'variant' : header_map.get('Variant', ''),
'chess960' : 'fischer' in header_map.get('Variant', '').lower() or '960' in header_map.get('Variant', ''),
'headers' : headers, 'headers' : headers,
'rows' : rows, 'rows' : rows,
'moves' : moves, 'moves' : moves,
@@ -344,6 +349,7 @@ def event_context(event, content):
'back_label' : 'Errors' if event.machine_id else 'Events', 'back_label' : 'Errors' if event.machine_id else 'Events',
'game' : None, 'game' : None,
'moves_json' : [], 'moves_json' : [],
'game_json' : None,
'log' : None, 'log' : None,
'download_name' : 'event%d.%s' % (event.id, 'pgn' if kind == 'pgn' else 'log'), 'download_name' : 'event%d.%s' % (event.id, 'pgn' if kind == 'pgn' else 'log'),
} }
@@ -352,6 +358,13 @@ def event_context(event, content):
if kind == 'pgn': if kind == 'pgn':
context['game'] = parse_pgn(content) context['game'] = parse_pgn(content)
context['moves_json'] = context['game']['moves'] context['moves_json'] = context['game']['moves']
context['game_json'] = {
'startFen' : context['game']['start_fen'],
'chess960' : context['game']['chess960'],
'white' : context['game']['white'],
'black' : context['game']['black'],
'note' : context['game']['final_note'] or context['game']['termination'],
}
elif kind == 'log': elif kind == 'log':
context['log'] = parse_log(content) context['log'] = parse_log(content)
@@ -362,6 +375,7 @@ def event_context(event, content):
context['kind'] = 'log' context['kind'] = 'log'
context['game'] = None context['game'] = None
context['moves_json'] = [] context['moves_json'] = []
context['game_json'] = None
context['log'] = parse_log(content) context['log'] = parse_log(content)
return context return context
@@ -2,7 +2,6 @@
<td class="col-author"><a href="/user/{{test.author}}">{{test.author|capfirst|slice:":6"}}</a></td> <td class="col-author"><a href="/user/{{test.author}}">{{test.author|capfirst|slice:":6"}}</a></td>
<td class="col-engine">{{test.dev_engine}}</td> <td class="col-engine">{{test.dev_engine}}</td>
<td class="col-test"> <td class="col-test">
<span class="status-dot status-{{ test|test_status }}" title="{{ test|test_status|capfirst }}"></span>
<a href="{{test|workload_url}}">{{test|prettyDevName}}</a> <a href="{{test|workload_url}}">{{test|prettyDevName}}</a>
{% if test.error %}<span class="flag flag-error" title="Crash or illegal move">crash</span>{% endif %} {% if test.error %}<span class="flag flag-error" title="Crash or illegal move">crash</span>{% endif %}
{% if test|test_is_fischer %}<span class="flag flag-frc" title="Fischer random chess">frc</span>{% endif %} {% if test|test_is_fischer %}<span class="flag flag-frc" title="Fischer random chess">frc</span>{% endif %}
+1
View File
@@ -16,6 +16,7 @@
<link rel="stylesheet" href="{% static 'form.css' %}?{{ static_version }}"> <link rel="stylesheet" href="{% static 'form.css' %}?{{ static_version }}">
<link rel="stylesheet" href="{% static 'paging.css' %}?{{ static_version }}"> <link rel="stylesheet" href="{% static 'paging.css' %}?{{ static_version }}">
<link rel="stylesheet" href="{% static 'ux.css' %}?{{ static_version }}"> <link rel="stylesheet" href="{% static 'ux.css' %}?{{ static_version }}">
<link rel="stylesheet" href="{% static 'board.css' %}?{{ static_version }}">
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css' rel='stylesheet'> <link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css' rel='stylesheet'>