use of com.instructure.canvasapi.model.RubricCriterionRating in project instructure-android by instructure.
the class AssignmentUnitTest method testRubricCriterion.
public static void testRubricCriterion(RubricCriterion rubricCriterion) {
assertNotNull(rubricCriterion);
assertNotNull(rubricCriterion.getId());
assertNotNull(rubricCriterion.getCriterionDescription());
assertNotNull(rubricCriterion.getLongDescription());
assertTrue(rubricCriterion.getPoints() >= 0);
if (rubricCriterion.getRatings() != null) {
for (RubricCriterionRating rubricCriterionRating : rubricCriterion.getRatings()) {
testRubricCriterionRating(rubricCriterionRating);
}
}
}
use of com.instructure.canvasapi.model.RubricCriterionRating in project instructure-android by instructure.
the class RubricRecyclerAdapter method saveCommentsCacheToRubricAssessment.
private void saveCommentsCacheToRubricAssessment() {
for (Map.Entry<String, RubricCriterionRating> entry : mCommentRowItems.entrySet()) {
// It's possible to save a submission comment, without marking a grade, in which case the submission
// rubric assessment will not contain a key for that criterion id. In this case,
// we need to create a new rubric rating and save that.
RubricCriterionRating rating = entry.getValue();
if (rating == null) {
return;
}
String newComment = rating.getComments();
if (mRubricAssessment.containsKey(entry.getKey())) {
RubricCriterionRating oldRating = mRubricAssessment.get(entry.getKey());
if (!Const.NO_COMMENT.equals(rating.getComments())) {
// If there is a new comment entered. Use that, otherwise save the original comment
oldRating.setComments(newComment);
}
if (mAssignment.isFreeFormCriterionComments()) {
oldRating.setPoints(rating.getPoints());
}
} else {
if (Const.NO_COMMENT.equals(newComment)) {
// If no prior comment and no new comment, save an empty string
rating.setComments("");
}
mRubricAssessment.put(entry.getKey(), rating);
}
}
}
use of com.instructure.canvasapi.model.RubricCriterionRating in project instructure-android by instructure.
the class RubricRecyclerAdapter method populateRatingItems.
// endregion
// region populate adapters
/**
* Populates the adapter with RubricCriterionRatings from the ASSIGNMENT rubric. RubricCriterionRatings from
* the Submission RubricAssessment should not be used here.
* @param rubric
*/
private void populateRatingItems(List<RubricCriterion> rubric) {
int insertCount = 0;
for (RubricCriterion rubricCriterion : rubric) {
final List<RubricCriterionRating> rubricCriterionRatings = rubricCriterion.getRatingsWithCriterionIds();
for (RubricCriterionRating rating : rubricCriterionRatings) {
mInsertedOrderHash.put(rubricCriterion.getId(), ++insertCount);
addOrUpdateItem(rubricCriterion, rating);
}
// Add an additional row to each rubric criterion for comments
RubricCriterionRating comment = createCommentItem(rubricCriterion);
mCommentRowItems.put(rubricCriterion.getId(), comment);
mInsertedOrderHash.put(rubricCriterion.getId(), ++insertCount);
addOrUpdateItem(rubricCriterion, comment);
}
}
use of com.instructure.canvasapi.model.RubricCriterionRating in project instructure-android by instructure.
the class RubricRecyclerAdapter method createCommentItem.
private static RubricCriterionRating createCommentItem(RubricCriterion rubricCriterion) {
RubricCriterionRating commentItem = new RubricCriterionRating();
commentItem.setComments(Const.NO_COMMENT);
commentItem.setCriterionId(rubricCriterion.getId());
commentItem.setId(String.valueOf(App.getUniqueId()));
return commentItem;
}
use of com.instructure.canvasapi.model.RubricCriterionRating in project instructure-android by instructure.
the class RubricRecyclerAdapter method createFreeFormCommentItem.
private static RubricCriterionRating createFreeFormCommentItem(RubricCriterion rubricCriterion) {
RubricCriterionRating commentItem = new RubricCriterionRating();
commentItem.setIsFreeFormComment(true);
commentItem.setMaxPoints(rubricCriterion.getPoints());
commentItem.setComments(Const.NO_COMMENT);
commentItem.setPoints(Integer.MIN_VALUE);
commentItem.setCriterionId(rubricCriterion.getId());
commentItem.setId(String.valueOf(App.getUniqueId()));
return commentItem;
}
Aggregations