[gradebook2-dev] GRBK-1201 problem

Kim Huang kimhuang at oit.rutgers.edu
Mon May 14 08:23:38 PDT 2012


Oh, yes,
This is what we do in Rutgers version

in Gradebook2ComponentServiceImpl.java, function recalculateAssignmentWeights

I changed 
replace " if (!isRemoved && isWeighted) { "
					
with " if(!isRemoved) {"

will fix the problem.

Actually, without this further change, when you refresh the gradebook2, the disappear item will show. 

Here is the whole version of function recalculateAssignmentWeights

----------------------------------------------------------------------------
-Kim

private List<Assignment> recalculateAssignmentWeights(Category category, Boolean enforceEqualWeighting, List<Assignment> assignments) {
		
		List<Assignment> updatedAssignments = new ArrayList<Assignment>();

		boolean isExtraCreditCategory = category.isExtraCredit() == null ? false : category.isExtraCredit().booleanValue();
		int weightedCount = 0;
		if (assignments != null) {
			for (Assignment assignment : assignments) {
				boolean isRemoved = assignment.isRemoved();
				boolean isWeighted = assignment.isCounted();
				boolean isExtraCredit = assignment.isExtraCredit() == null ? false : assignment.isExtraCredit().booleanValue();
				if (isWeighted && (isExtraCreditCategory || !isExtraCredit) && !isRemoved) {
					weightedCount++;
				}
			}
		}

		int dropLowest = category.getDrop_lowest();
		if (weightedCount >= dropLowest) 
			weightedCount -= dropLowest;

		boolean doRecalculate = false;

		if (enforceEqualWeighting != null && enforceEqualWeighting.booleanValue() && !category.isEqualWeightAssignments().equals(Boolean.TRUE)) {
			category.setEqualWeightAssignments(enforceEqualWeighting);
			gbService.updateCategory(category);
		}

		doRecalculate = category.isEqualWeightAssignments() == null ? true : category.isEqualWeightAssignments().booleanValue();

		if (doRecalculate) {
			Double newWeight = gradeCalculations.calculateEqualWeight(weightedCount);
			if (assignments != null) {
				for (Assignment assignment : assignments) {
					boolean isRemoved = assignment.isRemoved();
					boolean isWeighted = assignment.isCounted();
					boolean isExtraCredit = assignment.isExtraCredit() == null ? false : assignment.isExtraCredit().booleanValue();
					//if (!isRemoved && isWeighted) {
					if(!isRemoved) {
						if (isExtraCredit && !isExtraCreditCategory)
							updatedAssignments.add(assignment);
						else {
							Assignment persistAssignment = gbService.getAssignment(assignment.getId());
							persistAssignment.setAssignmentWeighting(newWeight);
							gbService.updateAssignment(persistAssignment);
							updatedAssignments.add(persistAssignment);
						}
					}
				}
			}
		}
		return updatedAssignments;
	}


----- Original Message -----
From: "Jeremy Kusnetz" <JKusnetz at APUS.EDU>
To: gradebook2-dev at collab.sakaiproject.org
Sent: Monday, May 14, 2012 10:34:06 AM
Subject: [gradebook2-dev] GRBK-1201 problem

We are running 1.7.1 and have been hit by the bug described in
GRBK-1201.  We applied the patch which seemed to fix that problem, but
it has introduced a new issue.  Items that are not included in grade
disappear as soon as you save.  I backed the patch out and the items
reappear.

 

I'll update the JIRA.  Any thoughts?

 

 

This message is private and confidential. If you have received it in error, please notify the sender and remove it from your system.

_______________________________________________
gradebook2-dev mailing list
gradebook2-dev at collab.sakaiproject.org
http://collab.sakaiproject.org/mailman/listinfo/gradebook2-dev


More information about the gradebook2-dev mailing list