DailyReport IDailyReportsQuery.GetDailyReport(DayRange day) { var week = new DateTimeRange(day.Start.Value.AddDays(-7), day.End.Value); var month = new DateTimeRange(day.Start.Value.AddMonths(-1), day.End.Value); var web = _channelsQuery.GetChannel("Web"); var api = _channelsQuery.GetChannel("API"); var channels = new[] { web, api }; var userTypes = new[] { UserType.Member, UserType.Employer, UserType.Administrator, UserType.Custodian }; return(new DailyReport { Day = day, OpenJobAds = _jobAdReportsQuery.GetOpenJobAds(), ResumeSearchAlerts = _memberSearchReportsQuery.GetMemberSearchAlerts(), JobSearchAlerts = _jobAdSearchReportsQuery.GetJobAdSearchAlerts(), JobSearches = _jobAdSearchReportsQuery.GetJobAdSearches(day), InternalJobApplications = _jobAdReportsQuery.GetInternalApplications(day), ExternalJobApplications = _jobAdReportsQuery.GetExternalApplications(day), InvitationsSent = _networkingReportsQuery.GetInvitationsSent(day), InvitationsAccepted = _networkingReportsQuery.GetInvitationsAccepted(day), AcceptanceRateLast48Hours = (int)_networkingReportsQuery.Get48HourInvitationAcceptancePercent(), AcceptanceRatePreviousMonth = (int)_networkingReportsQuery.GetMonthlyInvitationAcceptancePercent(), MemberReport = new MemberReport { Total = _accountReportsQuery.GetUsers(UserType.Member, day.End.Value), Enabled = _accountReportsQuery.GetEnabledUsers(UserType.Member, day.End.Value), Active = _accountReportsQuery.GetActiveUsers(UserType.Member, day.End.Value), New = _accountReportsQuery.GetNewUsers(UserType.Member, day), }, ResumeReport = new ResumeReport { Total = _resumeReportsQuery.GetResumes(day.End.Value), Searchable = _resumeReportsQuery.GetSearchableResumes(day.End.Value), New = _resumeReportsQuery.GetNewResumes(day), Uploaded = _resumeReportsQuery.GetUploadedResumes(day), Reloaded = _resumeReportsQuery.GetReloadedResumes(day), Edited = _resumeReportsQuery.GetEditedResumes(day), Updated = _resumeReportsQuery.GetUpdatedResumes(day), }, // Logins. DailyLogIns = (from u in userTypes select new { UserType = u, LogIns = _accountReportsQuery.GetLogIns(u, day) }).ToDictionary(x => x.UserType, x => x.LogIns), WeeklyLogIns = (from u in userTypes select new { UserType = u, LogIns = _accountReportsQuery.GetLogIns(u, week) }).ToDictionary(x => x.UserType, x => x.LogIns), MonthlyLogIns = (from u in userTypes select new { UserType = u, LogIns = _accountReportsQuery.GetLogIns(u, month) }).ToDictionary(x => x.UserType, x => x.LogIns), // Member search reports. MemberSearchReports = (from c in channels select new { c.Name, Report = new MemberSearchReport { TotalSearches = _memberSearchReportsQuery.GetMemberSearches(c, day), FilterSearches = _memberSearchReportsQuery.GetFilterMemberSearches(c, day), SavedSearches = _memberSearchReportsQuery.GetSavedMemberSearches(c, day), AnonymousSearches = _memberSearchReportsQuery.GetAnonymousMemberSearches(c, day), } }).ToDictionary(x => x.Name, x => x.Report), MemberViewingReports = (from c in channels select new { c.Name, Report = _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(c, day), }).ToDictionary(x => x.Name, x => x.Report), MemberAccessReports = (from c in channels select new { c.Name, Report = _employerMemberAccessReportsQuery.GetEmployerMemberAccessReport(c, day), }).ToDictionary(x => x.Name, x => x.Report), // Others. OrderReports = _orderReportsQuery.GetOrderReports(day), CommunciationReports = GetCommunicationReports(day), PromotionCodeReports = _registrationReportsQuery.GetPromotionCodeReports(day).ToDictionary(x => x.Key, x => x.Value), JobAdIntegrationReports = GetJobAdIntegrationReports(day), }); }
public void TestUploadTimeAgo() { // Created long time ago. var candidate = CreateCandidateWithResumeFile(); // Uploaded long time ago. _resumeReportsCommand.CreateResumeEvent(new ResumeUploadEvent { CandidateId = candidate.Id, ResumeId = candidate.ResumeId.Value, Time = DateTime.Now.AddDays(-10) }); Assert.AreEqual(1, _resumeReportsQuery.GetResumes(DateTime.Now.Date)); Assert.AreEqual(0, _resumeReportsQuery.GetNewResumes(DayRange.Yesterday)); Assert.AreEqual(0, _resumeReportsQuery.GetUploadedResumes(DayRange.Yesterday)); Assert.AreEqual(0, _resumeReportsQuery.GetReloadedResumes(DayRange.Yesterday)); Assert.AreEqual(0, _resumeReportsQuery.GetEditedResumes(DayRange.Yesterday)); Assert.AreEqual(0, _resumeReportsQuery.GetUpdatedResumes(DayRange.Yesterday)); }