Example #1
0
        public void TestGetJobApplications()
        {
            var employer = CreateEmployer(1);
            var jobAd    = _jobAdsCommand.PostTestJobAd(employer);

            var application = new InternalApplication
            {
                PositionId      = jobAd.Id,
                ApplicantId     = Guid.NewGuid(),
                CoverLetterText = "Cover letter"
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            application.CreatedTime = DateTime.Now.AddDays(-1);
            _applicationsCommand.UpdateApplication(application);

            application = new InternalApplication
            {
                PositionId      = jobAd.Id,
                ApplicantId     = Guid.NewGuid(),
                CoverLetterText = "Cover letter"
            };
            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            application.CreatedTime = DateTime.Now.AddDays(-1);
            _applicationsCommand.UpdateApplication(application);

            Assert.AreEqual(2, _jobAdReportsQuery.GetInternalApplications(DayRange.Yesterday));
        }
Example #2
0
        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),
            });
        }