mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 12:56:30 +00:00
fixed sorting in datasetexplorer, also show date
make annotationstatus more clear
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -59,8 +59,7 @@ public enum AnnotationStatus
|
||||
{
|
||||
None = 0,
|
||||
Created = 10,
|
||||
ValidatedEdited = 20,
|
||||
|
||||
Edited = 20,
|
||||
Validated = 30,
|
||||
Deleted = 40
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class AnnotationService : IAnnotationService, INotificationHandler<Annota
|
||||
|
||||
if (email != _api.CurrentUser.Email) //Don't process messages by yourself
|
||||
{
|
||||
if (annotationStatus.In(AnnotationStatus.Created, AnnotationStatus.ValidatedEdited))
|
||||
if (annotationStatus.In(AnnotationStatus.Created, AnnotationStatus.Edited))
|
||||
{
|
||||
var msg = MessagePackSerializer.Deserialize<AnnotationMessage>(message.Data.Contents);
|
||||
await SaveAnnotationInner(
|
||||
@@ -161,25 +161,18 @@ public class AnnotationService : IAnnotationService, INotificationHandler<Annota
|
||||
|
||||
if (ann != null) //Annotation is already exists
|
||||
{
|
||||
status = AnnotationStatus.Edited;
|
||||
|
||||
var annotationUpdatable = db.Annotations
|
||||
.Where(x => 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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user