You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kmftools/bookscraper/templates/debug/inspect_state.html

89 lines
1.8 KiB

{% extends "layout.html" %} {% block content %}
<h1>State Inspection (SQL vs Redis)</h1>
<style>
.state-card {
border: 1px solid #444;
padding: 18px;
margin-bottom: 30px;
background: #222;
border-radius: 8px;
}
.state-title {
font-size: 1.4em;
margin-bottom: 14px;
color: #9cf;
}
table.state-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 12px;
}
.state-table th,
.state-table td {
border: 1px solid #555;
padding: 6px 10px;
}
.state-table th {
background: #333;
color: #fff;
}
.same {
color: #9f9;
}
.diff {
color: #ff7b7b;
font-weight: bold;
}
.empty {
color: #aaa;
font-style: italic;
}
</style>
{% macro cmp(sqlval, redisval) %} {% if (sqlval|string) == (redisval|string) %}
<td class="same">{{ sqlval }}</td>
<td class="same">{{ redisval }}</td>
{% else %}
<td class="diff">{{ sqlval }}</td>
<td class="diff">{{ redisval }}</td>
{% endif %} {% endmacro %} {% for entry in results %}
<div class="state-card">
<div class="state-title">📘 {{ entry.book_id }}</div>
{% set sql = entry.sqlite %} {% set redis = entry.redis %} {% set merged =
entry.would_merge_to %}
<table class="state-table">
<tr>
<th>Field</th>
<th>SQLite</th>
<th>Redis</th>
<th>Merged Result</th>
</tr>
{% for field in [ "status", "chapters_total", "downloaded",
"chapters_download_done", "chapters_download_skipped", "parsed",
"chapters_parsed_done", "audio_done", "audio_skipped", "last_update" ] %}
<tr>
<th>{{ field }}</th>
<td>{{ sql.get(field, '') }}</td>
<td>{{ redis.get(field, '') }}</td>
<td>{{ merged.get(field, '') }}</td>
</tr>
{% endfor %}
</table>
</div>
{% endfor %} {% endblock %}