New Year revamp #40

Merged
FrederikBaerentsen merged 31 commits from gregoo/BrickTracker:master into master 2025-01-19 08:19:01 +01:00
4 changed files with 27 additions and 0 deletions
Showing only changes of commit 0d9276f639 - Show all commits

View File

@ -58,4 +58,9 @@ CREATE TABLE IF NOT EXISTS missing (
u_id TEXT
);
-- Fix a bug where 'None' was inserted in missing instead of NULL
UPDATE missing
SET element_id = NULL
WHERE element_id = 'None';
COMMIT;

View File

@ -0,0 +1,3 @@
SELECT count(*) AS count
FROM missing
WHERE element_id = 'None'

View File

@ -36,6 +36,7 @@ def admin() -> str:
counters: dict[str, int] = {}
exception: Exception | None = None
is_init: bool = False
count_none: int = 0
# This view needs to be protected against SQL errors
try:
@ -43,6 +44,11 @@ def admin() -> str:
if is_init:
counters = BrickSQL.count_records()
record = BrickSQL().fetchone('missing/count_none')
if record is not None:
count_none = record['count']
except Exception as e:
exception = e
@ -67,6 +73,7 @@ def admin() -> str:
'admin.html',
configuration=BrickConfigurationList.list(),
counters=counters,
count_none=count_none,
error=request.args.get('error'),
exception=exception,
instructions=BrickInstructionsList(),

View File

@ -13,6 +13,18 @@
</form>
</div>
{% else %}
{% if count_none %}
<div class="alert alert-warning" role="alert">
<p>
Your <code>missing</code> table contains <code>"None"</code> entries (instead of <code>NULL</code>). <br>
This can lead to "phantom" missing parts appearing in your sets if you are coming from the original version of BrickTracker.
</p>
<hr>
<form action="{{ url_for('admin.init_database') }}" method="post" class="text-end">
<button type="submit" class="btn btn-warning"><i class="ri-capsule-line"></i> Apply the fix</button>
</form>
</div>
{% endif %}
<p><i class="ri-checkbox-circle-line"></i> The database is initialized.</p>
<p>
<a href="{{ url_for('admin.download_database') }}" class="btn btn-primary" role="button"><i class="ri-download-line"></i> Download the database file</a>