Search in sources :

Example 1 with RubricCriterionAssessment

use of com.instructure.canvasapi2.models.RubricCriterionAssessment in project instructure-android by instructure.

the class RubricRecyclerAdapter method addTotalPointsFromRange.

/**
 * We only want to add a score if the rubric uses a range, otherwise they already know their score
 * @param rubricCriterion
 */
private int addTotalPointsFromRange(RubricCriterion rubricCriterion, int insertCount) {
    if (!rubricCriterion.getCriterionUseRange())
        return insertCount;
    Submission lastSubmission = mAssignment.getSubmission();
    if (lastSubmission != null) {
        RubricCriterionAssessment rating = lastSubmission.getRubricAssessment().get(rubricCriterion.getId());
        if (rating != null) {
            RubricCriterionRating rubricCriterionRating = new RubricCriterionRating();
            rubricCriterionRating.setDescription(getContext().getString(R.string.score));
            if (rating.getPoints() != null) {
                rubricCriterionRating.setPoints(rating.getPoints());
            }
            rubricCriterionRating.setId("null" + (rubricCriterion.getId()));
            mInsertedOrderHash.put(rubricCriterion.getId(), ++insertCount);
            addOrUpdateItem(rubricCriterion, new RubricRatingItem(rubricCriterionRating));
        }
    }
    return insertCount;
}
Also used : RubricRatingItem(com.instructure.candroid.model.RubricRatingItem) RubricCriterionRating(com.instructure.canvasapi2.models.RubricCriterionRating) Submission(com.instructure.canvasapi2.models.Submission) RubricCriterionAssessment(com.instructure.canvasapi2.models.RubricCriterionAssessment)

Example 2 with RubricCriterionAssessment

use of com.instructure.canvasapi2.models.RubricCriterionAssessment in project instructure-android by instructure.

the class RubricRecyclerAdapter method onBindChildHolder.

@Override
public void onBindChildHolder(RecyclerView.ViewHolder holder, RubricCriterion rubricCriterion, RubricItem rubricItem) {
    if (!mAssignment.isMuted()) {
        RubricCriterionAssessment assessment = mAssessmentMap.get(rubricCriterion.getId());
        RubricBinder.Companion.bind(getContext(), (RubricViewHolder) holder, rubricItem, rubricCriterion, mAssignment.isFreeFormCriterionComments(), assessment, mCanvasContext);
    }
}
Also used : RubricCriterionAssessment(com.instructure.canvasapi2.models.RubricCriterionAssessment)

Example 3 with RubricCriterionAssessment

use of com.instructure.canvasapi2.models.RubricCriterionAssessment in project instructure-android by instructure.

the class SubmissionManager_Test method updateRubricAssessment.

public static void updateRubricAssessment(long courseId, long assignmentId, long studentId, Map<String, RubricCriterionAssessment> assessmentMap, StatusCallback<Submission> callback) {
    // TODO:
    Response response = new Response.Builder().request(new Request.Builder().url("https://test.com").build()).code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
    Submission submission = new Submission();
    retrofit2.Response<Submission> response1 = retrofit2.Response.success(submission, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) Submission(com.instructure.canvasapi2.models.Submission) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) Request(okhttp3.Request)

Example 4 with RubricCriterionAssessment

use of com.instructure.canvasapi2.models.RubricCriterionAssessment in project instructure-android by instructure.

the class SubmissionManager method updateRubricAssessment.

public static void updateRubricAssessment(long courseId, long assignmentId, long studentId, Map<String, RubricCriterionAssessment> assessmentMap, @NonNull StatusCallback<Submission> callback) {
    if (isTesting() || mTesting) {
        SubmissionManager_Test.updateRubricAssessment(courseId, assignmentId, studentId, assessmentMap, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().build();
        SubmissionAPI.updateRubricAssessment(courseId, assignmentId, studentId, assessmentMap, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 5 with RubricCriterionAssessment

use of com.instructure.canvasapi2.models.RubricCriterionAssessment in project instructure-android by instructure.

the class SubmissionAPI method generateRubricAssessmentQueryMap.

private static Map<String, String> generateRubricAssessmentQueryMap(Map<String, RubricCriterionAssessment> rubricAssessment) {
    Map<String, String> map = new HashMap<>();
    for (Map.Entry<String, RubricCriterionAssessment> entry : rubricAssessment.entrySet()) {
        RubricCriterionAssessment rating = entry.getValue();
        String criterionId = entry.getKey();
        if (rating.getPoints() != null) {
            map.put(assessmentPrefix + criterionId + pointsPostFix, String.valueOf(rating.getPoints()));
        }
        map.put(assessmentPrefix + criterionId + commentsPostFix, TextUtils.isEmpty(rating.getComments()) ? "" : rating.getComments());
    }
    return map;
}
Also used : HashMap(java.util.HashMap) RubricCriterionAssessment(com.instructure.canvasapi2.models.RubricCriterionAssessment) QueryMap(retrofit2.http.QueryMap) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

RubricCriterionAssessment (com.instructure.canvasapi2.models.RubricCriterionAssessment)3 Submission (com.instructure.canvasapi2.models.Submission)2 RubricRatingItem (com.instructure.candroid.model.RubricRatingItem)1 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)1 RestParams (com.instructure.canvasapi2.builders.RestParams)1 RubricCriterionRating (com.instructure.canvasapi2.models.RubricCriterionRating)1 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Request (okhttp3.Request)1 Response (okhttp3.Response)1 QueryMap (retrofit2.http.QueryMap)1