use of com.instructure.canvasapi.model.RubricCriterionRating in project instructure-android by instructure.
the class RubricRecyclerAdapter method populateFreeFormRatingItems.
private void populateFreeFormRatingItems(List<RubricCriterion> rubric) {
int insertCount = 0;
for (RubricCriterion rubricCriterion : rubric) {
RubricCriterionRating freeformItem = createFreeFormCommentItem(rubricCriterion);
mInsertedOrderHash.put(rubricCriterion.getId(), ++insertCount);
mCommentRowItems.put(rubricCriterion.getId(), freeformItem);
addOrUpdateItem(rubricCriterion, freeformItem);
}
}
use of com.instructure.canvasapi.model.RubricCriterionRating in project instructure-android by instructure.
the class RubricRecyclerAdapter method updateRubricAssessment.
/**
* Called by our RubricFragment's RubricAdapterToFragmentCallback method when a new rubric rating is selected
* @param newRating
*/
public void updateRubricAssessment(RubricCriterionRating newRating) {
RubricCriterionRating oldRating = getSubmissionRatingForCriterionId(newRating.getCriterionId());
RubricCriterion group = getCriterionById(newRating.getCriterionId());
if (hasRatingChanged(oldRating, newRating)) {
mRubricAssessment.put(newRating.getCriterionId(), newRating);
}
addOrUpdateItem(group, newRating);
updateOriginalRating(newRating.getCriterionId());
handleSaveButton();
}
use of com.instructure.canvasapi.model.RubricCriterionRating in project instructure-android by instructure.
the class RubricFragment method updateRubric.
/**
* Called by our SubmissionWebView for updating quiz results
* @param submission
*/
public void updateRubric(Submission submission) {
Toast.makeText(getActivity(), getString(R.string.gradeSaved), Toast.LENGTH_SHORT).show();
// Update our rubric assessment to reflect any new comment data
HashMap<String, RubricCriterionRating> rubric_assessment = new HashMap<String, RubricCriterionRating>();
for (RubricCriterionRating rating : mSubmission.getRubricAssessment().getRatings()) {
rubric_assessment.put(rating.getCriterionId(), rating);
}
mSubmissionListener.onSubmissionRubricAssessmentUpdated(rubric_assessment, submission.getScore(), submission.getGrade());
// Enable paging on viewpager
mSubmissionListener.setPagingEnabled(true);
mRecyclerAdapter.clear();
mAssignment = mOriginalAssignment;
}
use of com.instructure.canvasapi.model.RubricCriterionRating in project instructure-android by instructure.
the class RubricCriterionUnitTest method testRubricCriterionRating.
@Test
public void testRubricCriterionRating() {
Gson gson = CanvasRestAdapter.getGSONParser();
RubricCriterion[] rubricCriterions = gson.fromJson(rubricCriterionJSON, RubricCriterion[].class);
for (RubricCriterion rubricCriterion : rubricCriterions) {
if (rubricCriterion.getGradedCriterionRating() != null) {
List<RubricCriterionRating> ratings = rubricCriterion.getRatings();
for (RubricCriterionRating rubricCriterionRating : ratings) {
assertNotNull(rubricCriterionRating.getId());
assertNotNull(rubricCriterionRating.getRatingDescription());
}
}
}
}
use of com.instructure.canvasapi.model.RubricCriterionRating in project instructure-android by instructure.
the class SubmissionAPI method generateRubricAssessmentQueryMap.
private static Map<String, String> generateRubricAssessmentQueryMap(HashMap<String, RubricCriterionRating> rubricAssessment) {
Map<String, String> map = new HashMap<>();
for (Map.Entry<String, RubricCriterionRating> entry : rubricAssessment.entrySet()) {
RubricCriterionRating rating = entry.getValue();
map.put(assessmentPrefix + rating.getCriterionId() + pointsPostFix, String.valueOf(rating.getPoints()));
if (rating.getComments() != null && !TextUtils.isEmpty(rating.getComments())) {
map.put(assessmentPrefix + rating.getCriterionId() + commentsPostFix, rating.getComments());
}
}
return map;
}
Aggregations