コード例 #1
0
 public ReconReviewViewModel(ReviewCompletion reviewCompletion)
 {
     ReviewCompleteID = reviewCompletion.ReviewCompletionID;
     RecordID         = reviewCompletion.RecordRecordID;
     //Files = reviewCompletion.Record.PaperDocuments.Where(p => p.DeletePaperDocument == false).Select(pd => new ReadViewModel(pd)); ;
     ReviewItems = reviewCompletion.PaperQualities.Where(pq => pq.Status == Enums.Status.Current.ToString()).Select(pq => new ReviewItemViewModel(pq));
     Species     = reviewCompletion.LinkRecordUserSpecies.Select(l => l.Species.SpecieName).ToArray();
 }
コード例 #2
0
 public ReconOngoingReviewViewModel(ReviewCompletion ReviewCompletion)
 {
     ReviewCompletionID = ReviewCompletion.ReviewCompletionID;
     PublicationID      = ReviewCompletion.RecordRecordID;
     LastUpdatedTime    = ReviewCompletion.LastUpdateTime;
     CompletedNumber    = ReviewCompletion.PaperQualities.Count(pq => pq.Status == Enums.Status.Current.ToString() && pq.OptionOptionID != null);
     TotalNumber        = ReviewCompletion.PaperQualities.Count(pq => pq.Status == Enums.Status.Current.ToString());
     SpeciesNumber      = ReviewCompletion.LinkRecordUserSpecies.Count(lrus => lrus.Status == "Current");
 }
コード例 #3
0
        private double CompareTwoReview(ReviewCompletion rc1, ReviewCompletion rc2)
        {
            var num = (from r1 in rc1.PaperQualities
                       from r2 in
                       rc2.PaperQualities.Where(
                           rc2pq =>
                           rc2pq.CheckListCheckListID == r1.CheckListCheckListID &&
                           rc2pq.OptionOptionID == r1.OptionOptionID)
                       select r1).Count();

            return(num * 1.0 / rc1.PaperQualities.Count());
        }
コード例 #4
0
        public ActionResult NewReview()
        {
            var avaliableRecord = _db.Records.Where(
                r => r.PaperDocuments.Count(pd => pd.DeletePaperDocument == false) > 0 && r.DeleteRecord == false && r.AcceptanceStatus == "Accepted" && r.AcceptanceStatus_randomizer == "Pass TC1" &&
                r.ReviewCompletions.Count(rc => rc.Status == Enums.Status.Current.ToString() && rc.ComplesionDate != null && !rc.Reconciliation) >= 2 &&
                r.ReviewCompletions.Count(rc => rc.Status == Enums.Status.Current.ToString() && rc.Reconciliation) == 0 &&
                r.ReviewCompletions.Count(rc => rc.UserID == userid && rc.Status == Enums.Status.Current.ToString() && !rc.Reconciliation) == 0);

            var randomRecord = avaliableRecord.OrderBy(r => Guid.NewGuid()).FirstOrDefault();

            if (randomRecord == null)
            {
                throw new Exception("There are no more publication for you to review. Please contact admin for further assistance. Thank you for reviewing on IICARus Project");
            }

            var CheckList = _db.CheckLists.Include("ChecklistOptionLinks");

            var newReviewCompletion = new ReviewCompletion()
            {
                UserID         = userid,
                RecordRecordID = randomRecord.RecordID,
                Role           = Enums.userRoles.Reconciler,
                LastUpdateTime = DateTime.Now,
                Reconciliation = true
            };

            _db.ReviewCompletions.Add(newReviewCompletion);

            var newReviewItems = (from c in _db.CheckLists
                                  where !string.IsNullOrEmpty(c.CheckListNumber)
                                  select c).AsEnumerable().Select(checklist => new PaperQuality()
            {
                CheckListCheckListID = checklist.CheckListID,
                ReviewerId           = userid,
                RecordRecordID       = randomRecord.RecordID,
                ReviewCompletion     = newReviewCompletion,
                LastUpdateTime       = DateTime.Now
            }).ToList();

            _db.PaperQualities.AddRange(newReviewItems);

            _db.SaveChanges();

            var r1       = newReviewCompletion.Record.ReviewCompletions.Where(rc => rc.Status == Enums.Status.Current.ToString()).OrderBy(s => s.LastUpdateTime).FirstOrDefault();
            var r2       = newReviewCompletion.Record.ReviewCompletions.Where(rc => rc.Status == Enums.Status.Current.ToString()).OrderBy(s => s.LastUpdateTime).Skip(1).FirstOrDefault();
            var reviewIM = new ReconReviewInputModel(newReviewCompletion, r1, r2, _db.Species.ToList());

            return(View(reviewIM));
        }
コード例 #5
0
        public ActionResult NewReview()
        {
            var userid = (int)Membership.GetUser().ProviderUserKey;

            var randomRecord = new Record();

            if (User.IsInRole("SeniorReviewer"))
            {
                var avaliableRecord = _db.Records.Where(
                    r => r.AcceptanceStatus == "Accepted" &&
                    r.AcceptanceStatus_randomizer == "Pass TC1" &&
                    r.ReviewCompletions.Count(rc => rc.Status == "Current") == 0 &&
                    r.PaperDocuments.Count(pd => pd.DeletePaperDocument == false) > 0 &&
                    r.DeleteRecord == false);

                randomRecord = avaliableRecord.OrderBy(r => Guid.NewGuid()).FirstOrDefault();
            }
            else if (User.IsInRole("Reviewer"))
            {
                var avaliableRecord = _db.Records.Where(
                    r => r.DeleteRecord == false &&
                    r.PaperDocuments.Count(pd => pd.DeletePaperDocument == false) > 0 &&
                    r.ReviewCompletions.Count(rc => rc.Status == "Current" && rc.ComplesionDate != null) == 1 &&
                    r.ReviewCompletions.Count(rc => rc.Status == "Current") == 1 &&
                    r.ReviewCompletions.Count(rc => rc.Status == "Current" && rc.UserID == userid) == 0
                    );

                randomRecord = avaliableRecord.OrderBy(r => Guid.NewGuid()).FirstOrDefault();
            }
            else
            {
                ViewBag.ErrorMessage = "You do not have qualification for reviewing for IICARus project. Please complete the training programe first. Thank you for your interest in IICARus project.";
                return(View("Error"));
            }

            if (randomRecord == null)
            {
                ViewBag.ErrorMessage = "There are no more publication for you to review. Please contact admin for further assistance. Thank you for reviewing on IICARus Project";
                return(View("Error"));
            }

            /////////////// save review completion & review items
            var newReviewCompletion = new ReviewCompletion()
            {
                UserID         = userid,
                RecordRecordID = randomRecord.RecordID,
                Role           = User.IsInRole("SeniorReviewer") ? IICURas.Enums.userRoles.SeniorReviewer : IICURas.Enums.userRoles.Reviewer,
                LastUpdateTime = DateTime.Now
            };

            _db.ReviewCompletions.Add(newReviewCompletion);

            var newReviewItems = (from c in _db.CheckLists
                                  where !string.IsNullOrEmpty(c.CheckListNumber)
                                  select c).AsEnumerable().Select(checklist => new PaperQuality()
            {
                CheckListCheckListID = checklist.CheckListID,
                ReviewerId           = userid,
                RecordRecordID       = randomRecord.RecordID,
                ReviewCompletion     = newReviewCompletion,
                LastUpdateTime       = DateTime.Now
            }).ToList();

            _db.PaperQualities.AddRange(newReviewItems);

            _db.SaveChanges();

            var reviewIM = new ReviewInputModel
            {
                ReviewCompleteID = newReviewCompletion.ReviewCompletionID,

                RecordID = randomRecord.RecordID,

                Species = _db.Species.ToList(),

                COI = randomRecord.ConflicOfIntest,

                Funding = randomRecord.Funding,

                Files = randomRecord.PaperDocuments.Where(pd => pd.DeletePaperDocument == false).Select(pd => new ReadViewModel
                {
                    TrainingDocumentID = pd.PaperDocumentsID,
                    FileName           = pd.FileName,
                    FileType           = pd.FileType,
                    FileUrl            = pd.FileUrl,
                }).ToList(),

                ReviewItems = newReviewItems.Select(c => new ReviewItemInputModel
                {
                    ReviewItemID    = c.PaperQualityID,
                    PublicationID   = c.RecordRecordID,
                    CheckListID     = c.CheckListCheckListID,
                    Section         = c.CheckList.Section,
                    Item            = c.CheckList.Item,
                    ItemNumber      = c.CheckList.ItemNumber,
                    CheckListName   = c.CheckList.CheckListName,
                    CheckListNumber = c.CheckList.CheckListNumber,
                    Criteria        = c.CheckList.Criteria,
                    Critical        = c.CheckList.Critical,
                    Options         = c.CheckList.ChecklistOptionLinks.Where(o => o.Status == "Current").Select(o => o.Option).ToList(),
                }).ToList().OrderBy(c => float.Parse(c.ItemNumber, CultureInfo.InvariantCulture.NumberFormat)).ThenBy(c => c.CheckListNumber).ToList(),
            };

            return(View(reviewIM));
        }