use of de.tum.in.www1.artemis.domain.analytics.TextAssessmentEvent in project Artemis by ls1intum.
the class TutorEffortIntegrationTest method testCalculateTutorEfforts0MinutesOneTimestamp.
/**
* Tests the TutorEffortResource.calculateTutorEffort method with a scenario involving a distance between
* timestamps of 1 minute but
* @throws Exception
*/
@Test
@WithMockUser(username = "instructor", roles = "INSTRUCTOR")
public void testCalculateTutorEfforts0MinutesOneTimestamp() throws Exception {
List<TextAssessmentEvent> events = createTextAssessmentEventsInIntervals(1, 1);
textAssessmentEventRepository.saveAll(events);
List<TutorEffort> tutorEfforts = request.getList("/api/courses/" + course.getId() + "/exercises/" + exercise.getId() + "/tutor-effort", HttpStatus.OK, TutorEffort.class);
TutorEffort effortExpected = createTutorEffortObject(0);
assertThat(tutorEfforts).isNotNull().hasSize(1);
assertThat(tutorEfforts.get(0)).usingRecursiveComparison().isEqualTo(effortExpected);
}
use of de.tum.in.www1.artemis.domain.analytics.TextAssessmentEvent in project Artemis by ls1intum.
the class TutorEffortIntegrationTest method testCalculateTutorEffortsDistance10Minutes.
/**
* Tests the TutorEffortResource.calculateTutorEffort method with a scenario involving 10 minutes
* of distance between timestamps. In this case time difference between timestamps is not calculated
* as it is referred as a period of inactivity
* @throws Exception
*/
@Test
@WithMockUser(username = "instructor", roles = "INSTRUCTOR")
public void testCalculateTutorEffortsDistance10Minutes() throws Exception {
List<TextAssessmentEvent> events = createTextAssessmentEventsInIntervals(11, 10);
textAssessmentEventRepository.saveAll(events);
List<TutorEffort> tutorEfforts = request.getList("/api/courses/" + course.getId() + "/exercises/" + exercise.getId() + "/tutor-effort", HttpStatus.OK, TutorEffort.class);
TutorEffort effortExpected = createTutorEffortObject(0);
assertThat(tutorEfforts).isNotNull().hasSize(1);
assertThat(tutorEfforts.get(0)).usingRecursiveComparison().isEqualTo(effortExpected);
}
use of de.tum.in.www1.artemis.domain.analytics.TextAssessmentEvent in project ArTEMiS by ls1intum.
the class TextExerciseAnalyticsIntegrationTest method testGetNumberOfTutorsInvolvedInAssessingByExerciseAndCourseId.
/**
* Tests the get events endpoint with admin role
*/
@Test
@WithMockUser(username = "instructor", roles = "INSTRUCTOR")
public void testGetNumberOfTutorsInvolvedInAssessingByExerciseAndCourseId() throws Exception {
User user = new User();
user.setLogin("instructor");
user.setGroups(Set.of(course.getInstructorGroupName()));
userRepository.save(user);
TextAssessmentEvent event1 = database.createSingleTextAssessmentEvent(course.getId(), 0L, exercise.getId(), studentParticipation.getId(), textSubmission.getId());
TextAssessmentEvent event2 = database.createSingleTextAssessmentEvent(course.getId(), 1L, exercise.getId(), studentParticipation.getId(), textSubmission.getId());
// Add two events with two different tutor ids
textAssessmentEventRepository.saveAll(List.of(event1, event2));
int numberOfTutorsInvolved = request.get("/api/analytics/text-assessment/courses/" + course.getId() + "/text-exercises/" + exercise.getId() + "/tutors-involved", HttpStatus.OK, Integer.class);
assertThat(numberOfTutorsInvolved).isNotNull().isEqualTo(2);
}
use of de.tum.in.www1.artemis.domain.analytics.TextAssessmentEvent in project ArTEMiS by ls1intum.
the class TextExerciseAnalyticsIntegrationTest method testGetAllEventsByCourseId.
/**
* Tests the get events endpoint with admin role
*/
@Test
@WithMockUser(username = "admin", roles = "ADMIN")
public void testGetAllEventsByCourseId() {
User user = new User();
user.setLogin("admin");
user.setGroups(Set.of(course.getTeachingAssistantGroupName()));
userRepository.save(user);
TextAssessmentEvent event = database.createSingleTextAssessmentEvent(course.getId(), user.getId(), exercise.getId(), studentParticipation.getId(), textSubmission.getId());
ResponseEntity<Void> responseAddEvent = textAssessmentEventResource.addAssessmentEvent(event);
assertThat(responseAddEvent.getStatusCode()).isEqualTo(HttpStatus.OK);
ResponseEntity<List<TextAssessmentEvent>> responseFindEvents = textAssessmentEventResource.getEventsByCourseId(course.getId());
assertThat(responseFindEvents.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(responseFindEvents.getBody()).isEqualTo(List.of(event));
}
use of de.tum.in.www1.artemis.domain.analytics.TextAssessmentEvent in project ArTEMiS by ls1intum.
the class TutorEffortIntegrationTest method testCalculateTutorEfforts0MinutesOneTimestamp.
/**
* Tests the TutorEffortResource.calculateTutorEffort method with a scenario involving a distance between
* timestamps of 1 minute but
* @throws Exception
*/
@Test
@WithMockUser(username = "instructor", roles = "INSTRUCTOR")
public void testCalculateTutorEfforts0MinutesOneTimestamp() throws Exception {
List<TextAssessmentEvent> events = createTextAssessmentEventsInIntervals(1, 1);
textAssessmentEventRepository.saveAll(events);
List<TutorEffort> tutorEfforts = request.getList("/api/courses/" + course.getId() + "/exercises/" + exercise.getId() + "/tutor-effort", HttpStatus.OK, TutorEffort.class);
TutorEffort effortExpected = createTutorEffortObject(0);
assertThat(tutorEfforts).isNotNull().hasSize(1);
assertThat(tutorEfforts.get(0)).usingRecursiveComparison().isEqualTo(effortExpected);
}
Aggregations