Example #1
0
        public override DynamicDictionary BuildHeader(Assignment assignment)
        {
            dynamic header = Builder.BuildHeader(assignment);

            header.AssignmentDetails = new DynamicDictionary();


            RubricEvaluation rubricEvaluation = null;


            //Getting the assignment team for Student, and if its non-null then we take that team ID and find the RubricEvaluation
            //that they were the recipient of.
            AssignmentTeam at     = OSBLEController.GetAssignmentTeam(assignment, Student);
            int            teamId = 0;

            if (at != null)
            {
                teamId = at.TeamID;

                using (OSBLEContext db = new OSBLEContext())
                {
                    //Only want to look at evaluations where Evaluator.AbstractRole.CanGrade is true, otherwise
                    //the rubric evaluation is a  student rubric (not interested in them here)
                    rubricEvaluation = (from re in db.RubricEvaluations
                                        where re.AssignmentID == assignment.ID &&
                                        re.Evaluator.AbstractRole.CanGrade &&
                                        re.RecipientID == teamId
                                        select re).FirstOrDefault();
                }
            }

            //If the Rubric has been evaluated and is published, calculate the rubric grade % to display to the student
            if (rubricEvaluation != null && rubricEvaluation.IsPublished)
            {
                header.AssignmentDetails.hasGrade     = true;
                header.AssignmentDetails.assignmentID = assignment.ID;
                header.AssignmentDetails.cuID         = Student.ID;

                header.AssignmentDetails.DisplayValue = "View Graded Rubric " + RubricEvaluation.GetGradeAsPercent(rubricEvaluation.ID);
            }
            else
            {
                header.AssignmentDetails.DisplayValue = "Not Graded";
                header.AssignmentDetails.hasGrade     = false;
            }
            return(header);
        }
Example #2
0
        /// <summary>
        /// This function builds the column for Rubric Grades in the instructor assignment details table. Note: This only handles non-student-evaluated rubrics.
        /// </summary>
        /// <param name="assignmentTeam"></param>
        /// <returns></returns>
        public override DynamicDictionary BuildTableForTeam(IAssignmentTeam assignmentTeam)
        {
            Assignment assignment = assignmentTeam.Assignment;
            dynamic    data       = Builder.BuildTableForTeam(assignmentTeam);

            data.Grade = new DynamicDictionary();
            data.Grade.ActionValues = new
            {
                assignmentId = assignment.ID,
                cuId         = assignmentTeam.Team.TeamMembers.FirstOrDefault().CourseUserID,
                area         = ""
            };

            RubricEvaluation rubricEvaluation = null;

            using (OSBLEContext db = new OSBLEContext())
            {
                rubricEvaluation = db.RubricEvaluations.Where(re => re.RecipientID == assignmentTeam.TeamID &&
                                                              re.Evaluator.AbstractRole.CanGrade &&
                                                              re.AssignmentID == assignment.ID
                                                              ).FirstOrDefault();
            }

            data.Grade.LinkText = "Not Graded";
            if (rubricEvaluation != null)
            {
                //A rubric exists, so if it is not published, it's saved as draft. If it is
                //published, the rubric grade should be displayed.
                if (rubricEvaluation.IsPublished == false)
                {
                    data.Grade.LinkText = "Saved as Draft (" + RubricEvaluation.GetGradeAsPercent(rubricEvaluation.ID) + ")";
                }
                else
                {
                    data.Grade.LinkText = RubricEvaluation.GetGradeAsPercent(rubricEvaluation.ID);
                }
            }

            return(data);
        }