Search in sources :

Example 1 with RubricCriterion

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);
    }
}
Also used : Assignment(com.instructure.canvasapi.model.Assignment) RubricCriterion(com.instructure.canvasapi.model.RubricCriterion) Gson(com.google.gson.Gson) Test(org.junit.Test)

Example 2 with 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);
    }
}
Also used : RubricCriterion(com.instructure.canvasapi.model.RubricCriterion) Gson(com.google.gson.Gson) Test(org.junit.Test)

Example 3 with RubricCriterion

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);
    }
}
Also used : RubricCriterionRating(com.instructure.canvasapi.model.RubricCriterionRating) RubricCriterion(com.instructure.canvasapi.model.RubricCriterion)

Example 4 with RubricCriterion

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);
    }
}
Also used : RubricCriterionRating(com.instructure.canvasapi.model.RubricCriterionRating) RubricCriterion(com.instructure.canvasapi.model.RubricCriterion)

Example 5 with RubricCriterion

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();
}
Also used : RubricCriterionRating(com.instructure.canvasapi.model.RubricCriterionRating) RubricCriterion(com.instructure.canvasapi.model.RubricCriterion)

Aggregations

RubricCriterion (com.instructure.canvasapi.model.RubricCriterion)7 Gson (com.google.gson.Gson)4 RubricCriterionRating (com.instructure.canvasapi.model.RubricCriterionRating)4 Test (org.junit.Test)4 Assignment (com.instructure.canvasapi.model.Assignment)1