fixed template reminder times

This commit is contained in:
Sarah Faey 2022-12-05 17:05:31 +01:00
parent 4b7bba4424
commit 7394d120e1
3 changed files with 6 additions and 4 deletions

View file

@ -18,7 +18,7 @@ namespace Lieb.Models.GuildWars2.Raid
public Raid() { }
public Raid(RaidTemplate template) : base(template)
public Raid(RaidTemplate template) : base(template, template.TimeZone)
{
TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(template.TimeZone);
StartTimeUTC = TimeZoneInfo.ConvertTimeToUtc(template.StartTime, timeZone);

View file

@ -61,7 +61,7 @@ namespace Lieb.Models.GuildWars2.Raid
public RaidBase() { }
public RaidBase(RaidBase template)
public RaidBase(RaidBase template, string timeZoneString)
{
this.Title = template.Title;
this.Description = template.Description;
@ -84,13 +84,15 @@ namespace Lieb.Models.GuildWars2.Raid
IsRandomSignUpRole = role.IsRandomSignUpRole
});
}
TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneString);
foreach (RaidReminder reminder in template.Reminders)
{
this.Reminders.Add(new RaidReminder()
{
DiscordServerId = reminder.DiscordServerId,
DiscordChannelId = reminder.DiscordChannelId,
ReminderTimeUTC = reminder.ReminderTimeUTC,
ReminderTimeUTC = TimeZoneInfo.ConvertTimeToUtc(reminder.ReminderTimeUTC.DateTime, timeZone),
Message = reminder.Message,
Sent = false,
Type = reminder.Type,

View file

@ -345,7 +345,7 @@
}
foreach(StaticRaidReminder reminder in _staticReminders)
{
reminder.ReminderTimeUTC = await TimeZoneService.GetUTCDateTime(reminder.ReminderDate.Date + reminder.ReminderTime.TimeOfDay);
reminder.ReminderTimeUTC = reminder.ReminderDate.Date + reminder.ReminderTime.TimeOfDay;
reminder.Sent = true;
_template.Reminders.Add(reminder);
}