44 lines
1.8 KiB
C#
44 lines
1.8 KiB
C#
namespace PlotLine.Models;
|
|
|
|
public sealed class WritingActivityEvent
|
|
{
|
|
public long Sequence { get; set; }
|
|
public Guid EventID { get; set; }
|
|
public int BookID { get; set; }
|
|
public Guid ManuscriptID { get; set; }
|
|
public string Kind { get; set; } = "";
|
|
public string Source { get; set; } = "";
|
|
public string Provenance { get; set; } = "Observed";
|
|
public DateTime ReceivedUtc { get; set; }
|
|
public DateTime? ObservedUtc { get; set; }
|
|
public long Revision { get; set; }
|
|
public int WordsAfter { get; set; }
|
|
public int Added { get; set; }
|
|
public int Removed { get; set; }
|
|
public int Net => Added - Removed;
|
|
public string Coverage { get; set; } = "Accepted snapshots; writing time unknown";
|
|
public int? ChapterID { get; set; }
|
|
public string? ChapterTitle { get; set; }
|
|
}
|
|
public sealed class WritingActivitySettings
|
|
{
|
|
public bool Enabled { get; set; } = true;
|
|
public int RetentionDays { get; set; } = 365;
|
|
}
|
|
public sealed class WritingActivityPage
|
|
{
|
|
public int BookID { get; set; }
|
|
public Book? Book { get; set; }
|
|
public bool CanManage { get; set; }
|
|
public WritingActivitySettings Settings { get; set; } = new();
|
|
public IReadOnlyList<WritingActivityEvent> Events { get; set; } = [];
|
|
public int Added => Events.Where(e => e.Kind == "Change").Sum(e => e.Added);
|
|
public int Removed => Events.Where(e => e.Kind == "Change").Sum(e => e.Removed);
|
|
public int ActiveDays => Events.Where(e => e.Kind == "Change").Select(e => e.ReceivedUtc.Date).Distinct().Count();
|
|
}
|
|
public sealed record WritingActivityScope(Guid ParagraphID, int? BeforeChapterID, int? ChapterID, Guid? BeforeSceneID, Guid? SceneID);
|
|
public sealed record WritingChange(int BeforeWords, int AfterWords, int Added, int Removed, string Coverage, IReadOnlyList<WritingActivityScope> Scopes)
|
|
{
|
|
public int Net => Added - Removed;
|
|
}
|