use of com.instructure.canvasapi.model.RubricCriterion in project instructure-android by instructure.
the class AssignmentUnitTest method testRubricAssignment.
@Test
public void testRubricAssignment() {
Gson gson = CanvasRestAdapter.getGSONParser();
Assignment rubricAssignment = gson.fromJson(rubricAssignmentJSON, Assignment.class);
assertNotNull(rubricAssignment.getRubric());
List<RubricCriterion> rubricCriterions = rubricAssignment.getRubric();
assertEquals(rubricCriterions.size(), 3);
for (RubricCriterion rubricCriterion : rubricCriterions) {
testRubricCriterion(rubricCriterion);
}
}
use of com.instructure.canvasapi.model.RubricCriterion in project instructure-android by instructure.
the class RubricAssessmentUnitTest method testRubricAssessmentRating.
@Test
public void testRubricAssessmentRating() {
Gson gson = CanvasRestAdapter.getGSONParser();
RubricCriterion[] rubricCriterions = gson.fromJson(rubricAssessmentJSON, RubricCriterion[].class);
assertNotNull(rubricCriterions);
for (RubricCriterion rubricCriterion : rubricCriterions) {
assertNotNull(rubricCriterion);
assertTrue(rubricCriterion.getPoints() >= 0);
}
}
use of com.instructure.canvasapi.model.RubricCriterion 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.RubricCriterion 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.RubricCriterion 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();
}
Aggregations