Clean up DayOfWeekHelper.cs and remove unnecessary function

This commit is contained in:
Patrick Barron 2020-05-30 20:02:55 -04:00
parent 1b297eae78
commit acce726ed9

View File

@ -8,63 +8,58 @@ namespace Jellyfin.Data
{ {
public static List<DayOfWeek> GetDaysOfWeek(DynamicDayOfWeek day) public static List<DayOfWeek> GetDaysOfWeek(DynamicDayOfWeek day)
{ {
return GetDaysOfWeek(new List<DynamicDayOfWeek> { day }); var days = new List<DayOfWeek>(7);
}
public static List<DayOfWeek> GetDaysOfWeek(List<DynamicDayOfWeek> days) if (day == DynamicDayOfWeek.Sunday
{ || day == DynamicDayOfWeek.Weekend
var list = new List<DayOfWeek>(); || day == DynamicDayOfWeek.Everyday)
if (days.Contains(DynamicDayOfWeek.Sunday) ||
days.Contains(DynamicDayOfWeek.Weekend) ||
days.Contains(DynamicDayOfWeek.Everyday))
{ {
list.Add(DayOfWeek.Sunday); days.Add(DayOfWeek.Sunday);
} }
if (days.Contains(DynamicDayOfWeek.Saturday) || if (day == DynamicDayOfWeek.Monday
days.Contains(DynamicDayOfWeek.Weekend) || || day == DynamicDayOfWeek.Weekday
days.Contains(DynamicDayOfWeek.Everyday)) || day == DynamicDayOfWeek.Everyday)
{ {
list.Add(DayOfWeek.Saturday); days.Add(DayOfWeek.Monday);
} }
if (days.Contains(DynamicDayOfWeek.Monday) || if (day == DynamicDayOfWeek.Tuesday
days.Contains(DynamicDayOfWeek.Weekday) || || day == DynamicDayOfWeek.Weekday
days.Contains(DynamicDayOfWeek.Everyday)) || day == DynamicDayOfWeek.Everyday)
{ {
list.Add(DayOfWeek.Monday); days.Add(DayOfWeek.Tuesday);
} }
if (days.Contains(DynamicDayOfWeek.Tuesday) || if (day == DynamicDayOfWeek.Wednesday
days.Contains(DynamicDayOfWeek.Weekday) || || day == DynamicDayOfWeek.Weekday
days.Contains(DynamicDayOfWeek.Everyday)) || day == DynamicDayOfWeek.Everyday)
{ {
list.Add(DayOfWeek.Tuesday); days.Add(DayOfWeek.Wednesday);
} }
if (days.Contains(DynamicDayOfWeek.Wednesday) || if (day == DynamicDayOfWeek.Thursday
days.Contains(DynamicDayOfWeek.Weekday) || || day == DynamicDayOfWeek.Weekday
days.Contains(DynamicDayOfWeek.Everyday)) || day == DynamicDayOfWeek.Everyday)
{ {
list.Add(DayOfWeek.Wednesday); days.Add(DayOfWeek.Thursday);
} }
if (days.Contains(DynamicDayOfWeek.Thursday) || if (day == DynamicDayOfWeek.Friday
days.Contains(DynamicDayOfWeek.Weekday) || || day == DynamicDayOfWeek.Weekday
days.Contains(DynamicDayOfWeek.Everyday)) || day == DynamicDayOfWeek.Everyday)
{ {
list.Add(DayOfWeek.Thursday); days.Add(DayOfWeek.Friday);
} }
if (days.Contains(DynamicDayOfWeek.Friday) || if (day == DynamicDayOfWeek.Saturday
days.Contains(DynamicDayOfWeek.Weekday) || || day == DynamicDayOfWeek.Weekend
days.Contains(DynamicDayOfWeek.Everyday)) || day == DynamicDayOfWeek.Everyday)
{ {
list.Add(DayOfWeek.Friday); days.Add(DayOfWeek.Saturday);
} }
return list; return days;
} }
} }
} }