fix(import): keep a server rename on re-import and show multi-day sessions

A whole folder imported again to the server sent its folder name as the
sequence title on every run, undoing a rename made on the server. The
sink now sends a typed title as before, but the folder's default name
only to a sequence that has no title yet (it reads the sequence first).
The archive already applied a title only when it created the sequence.

A session that ends on another day, as a whole folder often does,
showed only its first date ("28/09/2026 · 18:02 → 18:05"), which read
as a few minutes on one day. Its plan row and Show plan heading now
show both dates, from two new invariant resources (with the
right-to-left arrow).

The Gap and Minimum boxes now show their tooltip while disabled, so the
reason Whole folder turns them off reaches them, not only the Sessions
check box. Doc comments that said a merge needs the same camera now
mention the whole-folder rule.

Tests: a server whole-folder import run twice keeps the server's rename
and still applies a typed title; multi-day time text in both reading
directions; and the Import view model's Group rules (folder only, cards
planned by sessions, switching drops splits, tooltips say why).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-26 23:33:16 +01:00
1 parent a34b33d50b
commit a809416199
13 files changed
+181 -25

No files matched your search

+12 -7
View File
@@ -13,10 +13,11 @@ namespace Chronos.App.Import;
/// protocol's resumable chunks and the hash computed while copying; the server checks that hash before it commits the
/// frame, and only then does the photo count as imported. Photos of one plan session share its session key, so the
/// server files them in one sequence — the same one when an interrupted import is started again. A typed session
/// title is set on that sequence once. A file the server refuses (a hash mismatch, a format it rejects) is listed in
/// <see cref="Report"/> and the import goes on (BRIEF §13: errors per file); a failed connection, sign-in or server
/// stops it. A file the server already held counts as a duplicate: the server answers so only for a copy that is not
/// flagged missing or damaged, and a server import never deletes anything from the card.
/// title is set on that sequence once; a whole folder's own name only on a sequence that has no title yet, so a rename
/// made on the server survives the next import of the folder. A file the server refuses (a hash mismatch, a format it
/// rejects) is listed in <see cref="Report"/> and the import goes on (BRIEF §13: errors per file); a failed connection,
/// sign-in or server stops it. A file the server already held counts as a duplicate: the server answers so only for a
/// copy that is not flagged missing or damaged, and a server import never deletes anything from the card.
/// </summary>
public sealed class ServerImportSink(ChronosClient client, string stagingDirectory) : IImportSink
{
@@ -85,16 +86,20 @@ public sealed class ServerImportSink(ChronosClient client, string stagingDirecto
Directory.Delete(folder);
}
if (committed is { Index: >= 0 } && session.Title is { Length: > 0 } title && _titled.Add(committed.SequenceId))
await SetTitleAsync(committed.SequenceId, title, cancellationToken).ConfigureAwait(false);
await SetTitleAsync(committed.SequenceId, title, keepExisting: title == session.DefaultTitle, cancellationToken).ConfigureAwait(false);
}
return results;
}
/// <summary>A refused title leaves the photos imported under the sequence's own name.</summary>
private async Task SetTitleAsync(Guid sequenceId, string title, CancellationToken cancellationToken)
/// <summary>
/// Names the sequence; with <paramref name="keepExisting"/> (the title the user did not type) only one without a
/// title. A refused title leaves the photos imported under the sequence's own name.
/// </summary>
private async Task SetTitleAsync(Guid sequenceId, string title, bool keepExisting, CancellationToken cancellationToken)
{
try
{
if (keepExisting && (await client.GetSequenceAsync(sequenceId, cancellationToken).ConfigureAwait(false)).Title is { Length: > 0 }) return;
await client.UpdateSequenceAsync(sequenceId, new UpdateSequenceRequest(title, null, null, null, null, null), cancellationToken).ConfigureAwait(false);
}
catch (ChronosApiException ex) when (IsRefusal(ex))