namespace BonchCalendar.Services; public class IssueTrackingService { private bool _isLastFacultyFetchSuccessful = true; private readonly List _unsuccessfulGroupFetches = []; private readonly List _unsuccessfulTimetableFetches = []; public void TrackFacultyFetch(bool isSuccessful) => _isLastFacultyFetchSuccessful = isSuccessful; public void TrackGroupFetch(int facultyId, int course, bool isSuccessful) { string key = $"{facultyId}/{course}"; if (!isSuccessful) { if (!_unsuccessfulGroupFetches.Contains(key)) _unsuccessfulGroupFetches.Add(key); } else _unsuccessfulGroupFetches.Remove(key); } public void TrackTimetableFetch(int facultyId, int groupId, bool isSuccessful) { string key = $"{facultyId}/{groupId}"; if (!isSuccessful) { if (!_unsuccessfulTimetableFetches.Contains(key)) _unsuccessfulTimetableFetches.Add(key); } else _unsuccessfulTimetableFetches.Remove(key); } public Dictionary GetReport() { Dictionary report = []; if (!_isLastFacultyFetchSuccessful) report.Add("/faculties", false); if (_unsuccessfulGroupFetches.Count > 0) report.Add("/groups", _unsuccessfulGroupFetches); if (_unsuccessfulTimetableFetches.Count > 0) report.Add("/timetable", _unsuccessfulTimetableFetches); return report; } }