Exemple #1
0
        public void Execute()
        {
            var      applicantsProvider = new JobApplicationProvider();
            var      reviewerProvider   = new ReviewerProvider();
            var      configs            = AppConfigsProvider.EscalationConfigs;
            Reviewer reviewer           = null;

            var unhandledApplicants = applicantsProvider
                                      .GetList(a => a.ReviewStatus == Models.ReviewStatus.Assigned &&
                                               a.RemindCount >= configs.RemindTheshold);

            if (unhandledApplicants.Count() == 0)
            {
                return;
            }

            foreach (var applicant in unhandledApplicants)
            {
                if (applicant.ReviewerId.HasValue)
                {
                    reviewer = reviewerProvider.Get(applicant.ReviewerId.Value);
                }

                var email = new TimeOutApplicationEscalationEmail()
                {
                    JobApplication = applicant,
                    Reviewer       = reviewer,
                    EscalationTo   = configs.ReportToEmails,
                };
                BackgroundEmailService.Create().Send(email);

                _logger.InfoFormat("Reviewing for applicant {0} has been escalated as reviewer {1} did not finish his review after {2} of reminds", applicant.Id, reviewer.Id, applicant.RemindCount);
            }
        }
        public JobApplication[] GetTimeOutApplicants()
        {
            var applicantsProvider = new JobApplicationProvider();
            var remindDelayTime    = AppConfigsProvider.RemindReviewersConfigs.DelayTime;

            return(applicantsProvider.GetList(a => a.ReviewStatus == Models.ReviewStatus.Assigned)
                   .Where(a => a.NeedToRemind(remindDelayTime))
                   .ToArray());
        }
Exemple #3
0
        public ActionResult Index(string order)
        {
            var jobApplicantService     = new JobApplicationProvider();
            var reviewerResourceServuce = new ReviewerProvider();
            var results = jobApplicantService.GetList().OrderByDescending(m => m.AppliedAt)
                          .Select(applicant => new ApplicantViewModel()
            {
                Applicant = applicant,
                Reviewer  = applicant.ReviewerId.HasValue ? reviewerResourceServuce.Get(applicant.ReviewerId.Value) : null
            });

            return(View(results));
        }
Exemple #4
0
        public void Execute()
        {
            var applicantsProvider = new JobApplicationProvider();
            var applicants2Update  = applicantsProvider.GetList(a => a.ReviewStatus == ReviewStatus.Assigned || a.ReviewStatus == ReviewStatus.New);

            if (!applicants2Update.Any())
            {
                return;
            }

            foreach (var applicant in applicants2Update)
            {
                ProcUpdate(applicant);
            }
        }
        public void Execute()
        {
            if (!CanExecute())
            {
                return;
            }

            var applicantService = new JobApplicationProvider();

            JobApplication[] freshApplicants = applicantService.GetList(ap => ap.ReviewStatus == Models.ReviewStatus.New);

            foreach (var applicant in freshApplicants)
            {
                AssignToReviewer(applicant);
            }
        }
        public ActionResult Index()
        {
            var reviewers     = new ReviewerProvider();
            var jobApplicants = new JobApplicationProvider();


            var avgDurations = jobApplicants.GetList()
                               .GroupBy(rvw => rvw.ReviewerId)
                               .Select(g => new
            {
                g.Key,
                AvgDuration =
                    g.Average(
                        x =>
                        ((x.RejectedOrAcceptedAt ?? DateTime.UtcNow) - x.AssignedToReviewerAt).HasValue
                                    ? Math.Max(
                            ((x.RejectedOrAcceptedAt ?? DateTime.UtcNow) - x.AssignedToReviewerAt).Value
                            .TotalSeconds / 3600, 0)
                                    : 0)
            });

            //var results = reviewers.GetList()
            //    .Join(avgDurations, rvw => rvw.Id, ad => ad.Key, (rvw, ad) => new ReviewerViewModel { Reviewer = rvw, AvgTime = ad.AvgDuration });

            var results = reviewers.GetList()
                          .GroupJoin(avgDurations,
                                     rvw => rvw.Id,
                                     ad => ad.Key,
                                     (rvw, ms) => new { rvw, ms = ms.DefaultIfEmpty() })
                          .SelectMany(
                z => z.ms.Select(ad => new { rvw = z.rvw, ad }))
                          .Select(x => new ReviewerViewModel()
            {
                Reviewer = x.rvw,
                AvgTime  = x.ad == null? 0 : Math.Round(x.ad.AvgDuration, 2)
            });



            return(View(results.ToList()));
        }