Ejemplo n.º 1
0
        public CaseExpandedView(ModCase modCase, IUser moderator, IUser lastModerator, IUser suspect, List <CommentExpandedView> comments, UserNoteExpandedView userNoteView)
        {
            ModCase       = new CaseView(modCase);
            Moderator     = DiscordUserView.CreateOrDefault(moderator);
            LastModerator = DiscordUserView.CreateOrDefault(lastModerator);
            Suspect       = DiscordUserView.CreateOrDefault(suspect);
            Comments      = comments;
            UserNote      = userNoteView;

            if (modCase.PunishedUntil != null)
            {
                if (modCase.PunishedUntil > modCase.CreatedAt)
                {
                    if (modCase.PunishedUntil < DateTime.UtcNow)
                    {
                        PunishmentProgress = 100;
                    }
                    else
                    {
                        double totalPunished   = (modCase.PunishedUntil.Value - modCase.CreatedAt).TotalSeconds;
                        double alreadyPunished = (DateTime.UtcNow - modCase.CreatedAt).TotalSeconds;

                        PunishmentProgress = alreadyPunished / totalPunished * 100;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public ModCaseTableEntry(ModCase modCase, IUser moderator, IUser suspect)
 {
     ModCase   = new CaseView(modCase);
     Moderator = DiscordUserView.CreateOrDefault(moderator);
     Suspect   = DiscordUserView.CreateOrDefault(suspect);
 }