From f589c825ca3536cf4948ccb151c30c24871cfdaf Mon Sep 17 00:00:00 2001 From: Paul Fresquet Date: Thu, 19 Feb 2026 17:34:14 +0100 Subject: [PATCH 1/3] Add skipped entries counter to inventory monitor data --- .../Business/Inventories/InventoryMonitorData.cs | 5 ++++- .../Business/Inventories/InventoryProcessData.cs | 3 ++- .../Inventories/InventoryMonitorDataTests.cs | 15 ++++++++++++++- .../Inventories/InventoryProcessDataTests.cs | 16 ++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/ByteSync.Client/Business/Inventories/InventoryMonitorData.cs b/src/ByteSync.Client/Business/Inventories/InventoryMonitorData.cs index 7224fe22..88cdc0d9 100644 --- a/src/ByteSync.Client/Business/Inventories/InventoryMonitorData.cs +++ b/src/ByteSync.Client/Business/Inventories/InventoryMonitorData.cs @@ -23,6 +23,8 @@ public record InventoryMonitorData public long UploadTotalVolume { get; set; } public long UploadedVolume { get; set; } + + public int SkippedEntriesCount { get; set; } public bool HasNonZeroProperty() { @@ -36,6 +38,7 @@ public bool HasNonZeroProperty() || AnalyzableVolume != 0 || IdentifiedVolume != 0 || UploadTotalVolume != 0 - || UploadedVolume != 0; + || UploadedVolume != 0 + || SkippedEntriesCount != 0; } } diff --git a/src/ByteSync.Client/Business/Inventories/InventoryProcessData.cs b/src/ByteSync.Client/Business/Inventories/InventoryProcessData.cs index db331777..7ffdf0a0 100644 --- a/src/ByteSync.Client/Business/Inventories/InventoryProcessData.cs +++ b/src/ByteSync.Client/Business/Inventories/InventoryProcessData.cs @@ -147,6 +147,7 @@ public void RecordSkippedEntry(SkippedEntry entry) _skippedEntries.Enqueue(entry); _skippedCountsByReason.AddOrUpdate(entry.Reason, 1, (_, currentCount) => currentCount + 1); Interlocked.Increment(ref _skippedCount); + UpdateMonitorData(m => { m.SkippedEntriesCount += 1; }); } // should be used during issue 268 implementation @@ -182,4 +183,4 @@ private void ClearSkippedEntries() _skippedCountsByReason.Clear(); Interlocked.Exchange(ref _skippedCount, 0); } -} \ No newline at end of file +} diff --git a/tests/ByteSync.Client.UnitTests/Business/Inventories/InventoryMonitorDataTests.cs b/tests/ByteSync.Client.UnitTests/Business/Inventories/InventoryMonitorDataTests.cs index 6a45fd0b..0c395b53 100644 --- a/tests/ByteSync.Client.UnitTests/Business/Inventories/InventoryMonitorDataTests.cs +++ b/tests/ByteSync.Client.UnitTests/Business/Inventories/InventoryMonitorDataTests.cs @@ -149,6 +149,19 @@ public void HasNonZeroProperty_WithUploadedVolume_ShouldReturnTrue() // Assert result.Should().BeTrue(); } + + [Test] + public void HasNonZeroProperty_WithSkippedEntriesCount_ShouldReturnTrue() + { + // Arrange + var data = new InventoryMonitorData { SkippedEntriesCount = 2 }; + + // Act + var result = data.HasNonZeroProperty(); + + // Assert + result.Should().BeTrue(); + } [Test] public void HasNonZeroProperty_WithMultipleNonZeroProperties_ShouldReturnTrue() @@ -201,4 +214,4 @@ public void UploadTotalVolume_ShouldBeSettableAndGettable() // Assert data.UploadTotalVolume.Should().Be(10240); } -} \ No newline at end of file +} diff --git a/tests/ByteSync.Client.UnitTests/Business/Inventories/InventoryProcessDataTests.cs b/tests/ByteSync.Client.UnitTests/Business/Inventories/InventoryProcessDataTests.cs index b15cd755..da296adc 100644 --- a/tests/ByteSync.Client.UnitTests/Business/Inventories/InventoryProcessDataTests.cs +++ b/tests/ByteSync.Client.UnitTests/Business/Inventories/InventoryProcessDataTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Reactive.Linq; using ByteSync.Business.Inventories; using ByteSync.Models.Inventories; using FluentAssertions; @@ -44,6 +45,21 @@ public void RecordSkippedEntry_ShouldUpdateGlobalAndReasonCounters() data.GetSkippedCountByReason(SkipReason.NoiseEntry).Should().Be(1); data.GetSkippedCountByReason(SkipReason.Offline).Should().Be(0); } + + [Test] + public async Task RecordSkippedEntry_ShouldUpdateMonitorSkippedEntriesCount() + { + // Arrange + var data = new InventoryProcessData(); + + // Act + data.RecordSkippedEntry(new SkippedEntry { Reason = SkipReason.Hidden }); + data.RecordSkippedEntry(new SkippedEntry { Reason = SkipReason.NoiseEntry }); + var monitor = await data.InventoryMonitorObservable.FirstAsync(); + + // Assert + monitor.SkippedEntriesCount.Should().Be(2); + } [Test] public void Reset_ShouldClearSkippedEntriesAndCounters() From 7a816fdf1edbf3d5a7ba91cf2f8cb8af7cc2930c Mon Sep 17 00:00:00 2001 From: Paul Fresquet Date: Thu, 19 Feb 2026 17:35:53 +0100 Subject: [PATCH 2/3] Show local skipped entries count in identification view --- .../Assets/Resources/Resources.fr.resx | 3 +++ .../Assets/Resources/Resources.resx | 3 +++ .../InventoryLocalIdentificationViewModel.cs | 13 +++++++++++- .../InventoryLocalIdentificationView.axaml | 10 ++++++++++ ...entoryLocalIdentificationViewModelTests.cs | 20 ++++++++++++++++++- 5 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/ByteSync.Client/Assets/Resources/Resources.fr.resx b/src/ByteSync.Client/Assets/Resources/Resources.fr.resx index 1f53c5f1..beb1525b 100644 --- a/src/ByteSync.Client/Assets/Resources/Resources.fr.resx +++ b/src/ByteSync.Client/Assets/Resources/Resources.fr.resx @@ -397,6 +397,9 @@ Voulez-vous continuer ? Erreurs d'identification : + + Entrées ignorées : + Démarrage : diff --git a/src/ByteSync.Client/Assets/Resources/Resources.resx b/src/ByteSync.Client/Assets/Resources/Resources.resx index 395492ca..a9df1c7a 100644 --- a/src/ByteSync.Client/Assets/Resources/Resources.resx +++ b/src/ByteSync.Client/Assets/Resources/Resources.resx @@ -397,6 +397,9 @@ Would you like to continue ? Identification Errors: + + Skipped Entries: + Start: diff --git a/src/ByteSync.Client/ViewModels/Sessions/Inventories/InventoryLocalIdentificationViewModel.cs b/src/ByteSync.Client/ViewModels/Sessions/Inventories/InventoryLocalIdentificationViewModel.cs index bebb7a95..2d9a0490 100644 --- a/src/ByteSync.Client/ViewModels/Sessions/Inventories/InventoryLocalIdentificationViewModel.cs +++ b/src/ByteSync.Client/ViewModels/Sessions/Inventories/InventoryLocalIdentificationViewModel.cs @@ -52,6 +52,7 @@ private void HandleActivation(CompositeDisposable disposables) IdentifiedDirectories = m.IdentifiedDirectories; IdentifiedVolume = m.IdentifiedVolume; IdentificationErrors = m.IdentificationErrors; + SkippedEntriesCount = m.SkippedEntriesCount; }) .DisposeWith(disposables); @@ -59,6 +60,11 @@ private void HandleActivation(CompositeDisposable disposables) .Select(v => v > 0) .ToPropertyEx(this, x => x.HasIdentificationErrors) .DisposeWith(disposables); + + this.WhenAnyValue(x => x.SkippedEntriesCount) + .Select(v => v > 0) + .ToPropertyEx(this, x => x.ShowSkippedEntriesCount) + .DisposeWith(disposables); _inventoryService.InventoryProcessData.IdentificationStatus .ObserveOn(RxApp.MainThreadScheduler) @@ -133,8 +139,13 @@ private void HandleActivation(CompositeDisposable disposables) [Reactive] public int IdentificationErrors { get; set; } - + public extern bool HasIdentificationErrors { [ObservableAsProperty] get; } + + [Reactive] + public int SkippedEntriesCount { get; set; } + + public extern bool ShowSkippedEntriesCount { [ObservableAsProperty] get; } [Reactive] public string IdentificationIcon { get; set; } = "None"; diff --git a/src/ByteSync.Client/Views/Sessions/Inventories/InventoryLocalIdentificationView.axaml b/src/ByteSync.Client/Views/Sessions/Inventories/InventoryLocalIdentificationView.axaml index 4c5262a1..926dc39e 100644 --- a/src/ByteSync.Client/Views/Sessions/Inventories/InventoryLocalIdentificationView.axaml +++ b/src/ByteSync.Client/Views/Sessions/Inventories/InventoryLocalIdentificationView.axaml @@ -42,6 +42,7 @@ +