use of com.instructure.canvasapi2.models.Student in project instructure-android by instructure.
the class CourseListPresenterTest method setUp.
@Before
public void setUp() throws Exception {
course1 = new Course();
course2 = new Course();
Student student = new Student();
presenter = new CourseListPresenter(student);
}
use of com.instructure.canvasapi2.models.Student in project instructure-android by instructure.
the class WeekPresenterTest method setUp.
@Before
public void setUp() throws Exception {
Student student = new Student();
student.setStudentId("student_12345");
student.setParentId("parent_12345");
student.setStudentDomain("https://localhost.com");
student.setStudentName("Man in the Yellow Hat");
Course course = new Course();
course.setName("Curious George and the Hidden Course of Doom");
course.setCourseCode("course_12345");
mPresenter = new WeekViewPresenterFactory(student, course).create();
}
use of com.instructure.canvasapi2.models.Student in project instructure-android by instructure.
the class Analytics method trackEnrollment.
public static void trackEnrollment(Activity context, List<Course> courseList) {
if (context == null || courseList == null) {
return;
}
String enrollment = "Unknown";
// used to track how many teacher/student enrollments
int teacherCount = 0;
int studentCount = 0;
int observerCount = 0;
for (Course course : courseList) {
if (course.isTeacher()) {
teacherCount++;
} else if (course.isStudent()) {
studentCount++;
} else if (course.isObserver()) {
observerCount++;
}
}
// variable. This will set the custom dimension as whatever role is set the most
if (studentCount > teacherCount && studentCount > observerCount) {
// Set the dimension value for index 1 (Enrollment in GA, it is a 1 based list).
enrollment = "Student";
} else if (teacherCount >= studentCount && teacherCount >= observerCount) {
// Set the dimension value for index 1.(Enrollment in GA, it is a 1 based list).
enrollment = "Teacher";
} else {
// Set the dimension value for index 1.(Enrollment in GA, it is a 1 based list).
enrollment = "Observer";
}
Application application = context.getApplication();
if (application instanceof AnalyticsEventHandling) {
((AnalyticsEventHandling) application).trackEnrollment(enrollment);
}
}
use of com.instructure.canvasapi2.models.Student in project instructure-android by instructure.
the class UserManager_Test method getObserveesForParent.
public static void getObserveesForParent(String airwolfDomain, RestBuilder adapter, RestParams params, String parentId, StatusCallback<List<Student>> callback) {
adapter.setStatusCallback(callback);
Response response = new Response.Builder().code(200).message("success").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "success".getBytes())).addHeader("content-type", "application/json").build();
retrofit2.Response response1 = retrofit2.Response.success(response);
callback.onResponse(response1, new LinkHeaders(), ApiType.API);
}
use of com.instructure.canvasapi2.models.Student in project instructure-android by instructure.
the class CourseTest method isCourseGradeLocked_hideAllGradingPeriods.
@Test
public void isCourseGradeLocked_hideAllGradingPeriods() {
Course course = new Course();
course.setHasGradingPeriods(true);
Enrollment enrollment = new Enrollment();
enrollment.setType("student");
enrollment.setCurrentGradingPeriodId(0);
enrollment.setMultipleGradingPeriodsEnabled(true);
enrollment.setTotalsForAllGradingPeriodsOption(false);
ArrayList<Enrollment> enrollments = new ArrayList<>();
enrollments.add(enrollment);
course.setEnrollments(enrollments);
assertTrue(course.getCourseGrade(false).isLocked());
}
Aggregations