diff --git a/Azaion.Common/DTO/AnnotationThumbnail.cs b/Azaion.Common/DTO/AnnotationThumbnail.cs index 72ee3ea..f3e00e4 100644 --- a/Azaion.Common/DTO/AnnotationThumbnail.cs +++ b/Azaion.Common/DTO/AnnotationThumbnail.cs @@ -4,6 +4,7 @@ using System.Runtime.CompilerServices; using System.Windows.Media.Imaging; using Azaion.Common.Database; using Azaion.Common.Extensions; +using Azaion.CommonSecurity.DTO; namespace Azaion.Common.DTO; @@ -29,8 +30,11 @@ public class AnnotationThumbnail(Annotation annotation, bool isValidator) : INot } public string ImageName => Path.GetFileName(Annotation.ImagePath); + public string CreatedDate => $"{Annotation.CreatedDate:dd.MM.yyyy HH:mm:ss}"; public string CreatedEmail => Annotation.CreatedEmail; - public bool IsSeed => IsValidator && Annotation.AnnotationStatus == AnnotationStatus.Created; + public bool IsSeed => IsValidator && + Annotation.AnnotationStatus.In(AnnotationStatus.Created, AnnotationStatus.Edited) && + !Annotation.CreatedRole.IsValidator(); public event PropertyChangedEventHandler? PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) diff --git a/Azaion.Common/Database/Annotation.cs b/Azaion.Common/Database/Annotation.cs index 013f4a6..42c780c 100644 --- a/Azaion.Common/Database/Annotation.cs +++ b/Azaion.Common/Database/Annotation.cs @@ -59,8 +59,7 @@ public enum AnnotationStatus { None = 0, Created = 10, - ValidatedEdited = 20, - + Edited = 20, Validated = 30, Deleted = 40 } \ No newline at end of file diff --git a/Azaion.Common/Services/AnnotationService.cs b/Azaion.Common/Services/AnnotationService.cs index 64c9c23..63f0ddf 100644 --- a/Azaion.Common/Services/AnnotationService.cs +++ b/Azaion.Common/Services/AnnotationService.cs @@ -88,7 +88,7 @@ public class AnnotationService : IAnnotationService, INotificationHandler(message.Data.Contents); await SaveAnnotationInner( @@ -161,25 +161,18 @@ public class AnnotationService : IAnnotationService, INotificationHandler x.Name == fName) - .Set(x => x.Source, source) - .Set(x => x.CreatedRole, userRole); + .Set(x => x.Source, source); if (userRole.IsValidator() && source == SourceEnum.Manual) { - status = AnnotationStatus.ValidatedEdited; - annotationUpdatable = annotationUpdatable .Set(x => x.ValidateDate, createdDate) .Set(x => x.ValidateEmail, createdEmail); } - else - { - annotationUpdatable = annotationUpdatable - .Set(x => x.CreatedDate, createdDate) - .Set(x => x.CreatedEmail, createdEmail); - } await annotationUpdatable .Set(x => x.AnnotationStatus, status) diff --git a/Azaion.Common/Services/FailsafeProducer.cs b/Azaion.Common/Services/FailsafeProducer.cs index 8e93f08..4a2d877 100644 --- a/Azaion.Common/Services/FailsafeProducer.cs +++ b/Azaion.Common/Services/FailsafeProducer.cs @@ -66,7 +66,7 @@ public class FailsafeAnnotationsProducer { var records = await db.AnnotationsQueueRecords.OrderBy(x => x.DateTime).ToListAsync(token: ct); var editedCreatedNames = records - .Where(x => x.Operation.In(AnnotationStatus.Created, AnnotationStatus.ValidatedEdited)) + .Where(x => x.Operation.In(AnnotationStatus.Created, AnnotationStatus.Edited)) .Select(x => x.AnnotationNames.FirstOrDefault()) .ToList(); diff --git a/Azaion.Dataset/DatasetExplorer.xaml b/Azaion.Dataset/DatasetExplorer.xaml index 80ed4b5..c15c4ec 100644 --- a/Azaion.Dataset/DatasetExplorer.xaml +++ b/Azaion.Dataset/DatasetExplorer.xaml @@ -46,8 +46,14 @@ + Foreground="Gray"> + + + + + + + diff --git a/Azaion.Dataset/DatasetExplorer.xaml.cs b/Azaion.Dataset/DatasetExplorer.xaml.cs index 87bf21f..154be41 100644 --- a/Azaion.Dataset/DatasetExplorer.xaml.cs +++ b/Azaion.Dataset/DatasetExplorer.xaml.cs @@ -288,14 +288,18 @@ public partial class DatasetExplorer { SelectedAnnotations.Clear(); SelectedAnnotationDict.Clear(); - var annotations = _annotationsDict[ExplorerEditor.CurrentAnnClass.YoloId]; - foreach (var ann in annotations - .OrderBy(x => x.Value.AnnotationStatus) - .ThenByDescending(x => x.Value.CreatedDate)) + var annThumbnails = _annotationsDict[ExplorerEditor.CurrentAnnClass.YoloId] + .Select(x => new AnnotationThumbnail(x.Value, _azaionApi.CurrentUser.Role.IsValidator())) + .OrderBy(x => !x.IsSeed) + .ThenByDescending(x =>x.Annotation.CreatedDate); + + //var dict = annThumbnails.Take(20).ToDictionary(x => x.Annotation.Name, x => x.IsSeed); + + + foreach (var thumb in annThumbnails) { - var annThumb = new AnnotationThumbnail(ann.Value, _azaionApi.CurrentUser.Role.IsValidator()); - SelectedAnnotations.Add(annThumb); - SelectedAnnotationDict.Add(annThumb.Annotation.Name, annThumb); + SelectedAnnotations.Add(thumb); + SelectedAnnotationDict.Add(thumb.Annotation.Name, thumb); } await Task.CompletedTask; }