using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.Linq; using Octokit.Helpers; namespace Octokit { [DebuggerDisplay("{DebuggerDisplay,nq}")] public class WeeklyCommitActivity { public WeeklyCommitActivity() { } public WeeklyCommitActivity(IEnumerable days, int total, long week) { Ensure.ArgumentNotNull(days, "days"); Days = new ReadOnlyCollection(days.ToList()); Total = total; Week = week; } /// /// The days array is a group of commits per day, starting on Sunday. /// public IReadOnlyList Days { get; protected set; } /// /// Totally number of commits made this week. /// public int Total { get; protected set; } /// /// The week of commits /// public long Week { get; protected set; } public DateTimeOffset WeekTimestamp { get { return Week.FromUnixTime(); } } /// /// Get the number of commits made on any /// /// The day of the week /// The number of commits made public int GetCommitCountOn(DayOfWeek dayOfWeek) { return Days.ElementAt((int)dayOfWeek); } internal string DebuggerDisplay { get { return string.Format(CultureInfo.InvariantCulture, "Week: {0} Total Commits: {1}", WeekTimestamp, Total); } } } }