Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/application/usecases/library/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class SyncRunData:
processed: int
skipped: int
errors: int
handled: int
percent: int
is_active: bool
is_scanning: bool
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/library/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def _sync_status(run: models.SyncRun) -> library_dataclasses.SyncRunData:
processed=run.processed,
skipped=run.skipped,
errors=run.errors,
handled=handled,
percent=percent,
is_active=run.state in models.SyncRun.ACTIVE_STATES,
is_scanning=run.state == models.SyncRun.STATE_SCANNING,
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/templates/library/partials/sync_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{% if status.is_scanning %}
<span class="sync-status__label">Scanning…</span>
{% elif status.is_processing %}
<span class="sync-status__label">Processing {{ status.processed }}/{{ status.total }}</span>
<span class="sync-status__label">Processing {{ status.handled }}/{{ status.total }}</span>
<progress class="sync-status__bar" value="{{ status.percent }}" max="100"></progress>
{% elif status.is_completed %}
<span class="sync-status__label sync-status__label--done">Imported {{ status.processed }}{% if status.skipped %}, skipped {{ status.skipped }}{% endif %}{% if status.errors %}, {{ status.errors }} error{{ status.errors|pluralize }}{% endif %}</span>
Expand Down
16 changes: 16 additions & 0 deletions tests/functional/test_library_sync_status_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ def test_shows_progress_while_processing(self, client):
assert 'hx-trigger="every 2s"' in content
assert "<progress" in content

def test_processing_label_counts_skipped_and_errors(self, client):
# Regression: the label must show total handled (processed+skipped+errors),
# not just processed — otherwise non-Fujifilm folders show "0/N" forever
# while the progress bar advances.
folder = LibraryFolderFactory()
run = SyncRunFactory(folder=folder, state=models.SyncRun.STATE_PROCESSING, total=10)
run.processed = 0
run.skipped = 3
run.errors = 1
run.save(update_fields=["processed", "skipped", "errors"])

response = client.get(f"/library/{folder.pk}/sync-status/")

content = response.content.decode()
assert "Processing 4/10" in content

def test_shows_summary_and_stops_polling_when_completed(self, client):
folder = LibraryFolderFactory()
run = SyncRunFactory(folder=folder, state=models.SyncRun.STATE_COMPLETED, total=3)
Expand Down
Loading