use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentTest method isWithoutGradedSubmission_TestFalse.
@Test
public void isWithoutGradedSubmission_TestFalse() {
Assignment assignment = new Assignment();
Submission submission = new Submission();
submission.setWorkflowState("submitted");
submission.setGrade("A");
submission.setSubmissionType("Online_Quiz");
assignment.setSubmission(submission);
assertEquals(false, assignment.isWithoutGradedSubmission());
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentTest method hasRubric_TestFalse.
@Test
public void hasRubric_TestFalse() {
Assignment assignment = new Assignment();
assignment.setRubric(null);
assertEquals(false, assignment.hasRubric());
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentManager_Test method deleteAssignment.
public static void deleteAssignment(Assignment assignment, StatusCallback<Assignment> callback) {
// TODO:
Response httpResponse = 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();
retrofit2.Response<Assignment> response = retrofit2.Response.success(assignment, httpResponse);
callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class AssignmentManager_Test method editAssignment.
public static void editAssignment(AssignmentPostBody assignmentBody, StatusCallback<Assignment> callback) {
// TODO:
Response httpResponse = 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();
retrofit2.Response<Assignment> response = retrofit2.Response.success(new Assignment(), httpResponse);
callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
use of com.instructure.canvasapi2.models.Assignment in project instructure-android by instructure.
the class FileUploadAssignmentsAdapter method getOnlineUploadAssignmentsList.
public static ArrayList<Assignment> getOnlineUploadAssignmentsList(Context context, List<Assignment> newAssignments) {
ArrayList<Assignment> onlineUploadAssignments = new ArrayList<>();
Date currentDate = new Date();
for (Assignment assignment : newAssignments) {
if (assignment.getSubmissionTypes().contains(Assignment.SUBMISSION_TYPE.ONLINE_UPLOAD) && (assignment.getLockAt() == null || (assignment.getLockAt() != null && currentDate.before(assignment.getLockAt())))) {
onlineUploadAssignments.add(assignment);
}
}
// if empty, add no assignments assignment. Else add a selection prompt.
if (onlineUploadAssignments.size() == 0) {
Assignment noAssignments = new Assignment();
noAssignments.setId(Long.MIN_VALUE);
noAssignments.setName(context.getString(R.string.no_assignments_with_file_upload));
onlineUploadAssignments.add(noAssignments);
}
return onlineUploadAssignments;
}
Aggregations