Search in sources :

Example 81 with Assignment

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());
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) Submission(com.instructure.canvasapi2.models.Submission) Test(org.junit.Test)

Example 82 with Assignment

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());
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) Test(org.junit.Test)

Example 83 with Assignment

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);
}
Also used : Response(okhttp3.Response) Assignment(com.instructure.canvasapi2.models.Assignment) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) Request(okhttp3.Request)

Example 84 with Assignment

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);
}
Also used : Response(okhttp3.Response) Assignment(com.instructure.canvasapi2.models.Assignment) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) Request(okhttp3.Request)

Example 85 with Assignment

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;
}
Also used : Assignment(com.instructure.canvasapi2.models.Assignment) ArrayList(java.util.ArrayList) Date(java.util.Date)

Aggregations

Assignment (com.instructure.canvasapi2.models.Assignment)62 Test (org.junit.Test)46 Submission (com.instructure.canvasapi2.models.Submission)25 Date (java.util.Date)18 ArrayList (java.util.ArrayList)15 View (android.view.View)10 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)10 Course (com.instructure.canvasapi2.models.Course)9 RestParams (com.instructure.canvasapi2.builders.RestParams)7 Bundle (android.os.Bundle)6 ScheduleItem (com.instructure.canvasapi2.models.ScheduleItem)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)6 Navigation (com.instructure.interactions.Navigation)5 DrawableRes (android.support.annotation.DrawableRes)4 AdapterView (android.widget.AdapterView)4 TextView (android.widget.TextView)4 Request (okhttp3.Request)4 Response (okhttp3.Response)4 Paint (android.graphics.Paint)3 Drawable (android.graphics.drawable.Drawable)3