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;
}
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);
}
}
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);
}
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);
}
}
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;
}
Aggregations