def set_weighted_policy(self, hw_weight=0.25, final_weight=0.75): """ Set up a simple course for testing weighted grading functionality. """ grading_policy = { "GRADER": [ { "type": "Homework", "min_count": 1, "drop_count": 0, "short_label": "HW", "weight": hw_weight }, { "type": "Final", "min_count": 0, "drop_count": 0, "name": "Final Section", "short_label": "Final", "weight": final_weight } ] } self.add_grading_policy(grading_policy) task_compute_all_grades_for_course.apply_async(kwargs={'course_key': unicode(self.course.id)})
def set_weighted_policy(self, hw_weight=0.25, final_weight=0.75): """ Set up a simple course for testing weighted grading functionality. """ grading_policy = { "GRADER": [ { "type": "Homework", "min_count": 1, "drop_count": 0, "short_label": "HW", "weight": hw_weight }, { "type": "Final", "min_count": 0, "drop_count": 0, "name": "Final Section", "short_label": "Final", "weight": final_weight } ] } self.add_grading_policy(grading_policy) task_compute_all_grades_for_course.apply_async(kwargs={'course_key': str(self.course.id)})
def setUp(self): super(TestGradebook, self).setUp() instructor = AdminFactory.create() self.client.login(username=instructor.username, password='******') self.users = [UserFactory.create() for _ in range(USER_COUNT)] for user in self.users: CourseEnrollmentFactory.create(user=user, course_id=self.course.id) for i, item in enumerate(self.items): for j, user in enumerate(self.users): StudentModuleFactory.create( grade=1 if i < j else 0, max_grade=1, student=user, course_id=self.course.id, module_state_key=item.location ) task_compute_all_grades_for_course.apply_async(kwargs={'course_key': text_type(self.course.id)}) self.response = self.client.get(reverse( 'spoc_gradebook', args=(text_type(self.course.id),) )) self.assertEqual(self.response.status_code, 200)
def setUp(self): super(TestGradebook, self).setUp() instructor = AdminFactory.create() self.client.login(username=instructor.username, password='******') self.users = [UserFactory.create() for _ in range(USER_COUNT)] for user in self.users: CourseEnrollmentFactory.create(user=user, course_id=self.course.id) for i, item in enumerate(self.items): for j, user in enumerate(self.users): StudentModuleFactory.create( grade=1 if i < j else 0, max_grade=1, student=user, course_id=self.course.id, module_state_key=item.location ) task_compute_all_grades_for_course.apply_async(kwargs={'course_key': text_type(self.course.id)}) self.response = self.client.get(reverse( 'spoc_gradebook', args=(text_type(self.course.id),) )) self.assertEquals(self.response.status_code, 200)
def setup_students_and_grades(context): """ Create students and set their grades. :param context: class reference """ if context.course: context.student = student = UserFactory.create() CourseEnrollmentFactory.create(user=student, course_id=context.course.id) context.student2 = student2 = UserFactory.create(username='******') CourseEnrollmentFactory.create(user=student2, course_id=context.course.id) # create grades for self.student as if they'd submitted the ccx for chapter in context.course.get_children(): for i, section in enumerate(chapter.get_children()): for j, problem in enumerate(section.get_children()): # if not problem.visible_to_staff_only: StudentModuleFactory.create( grade=1 if i < j else 0, max_grade=1, student=context.student, course_id=context.course.id, module_state_key=problem.location ) StudentModuleFactory.create( grade=1 if i > j else 0, max_grade=1, student=context.student2, course_id=context.course.id, module_state_key=problem.location ) task_compute_all_grades_for_course.apply_async(kwargs={'course_key': str(context.course.id)})
def handle_grading_policy_changed(sender, **kwargs): # pylint: disable=unused-argument """ Receives signal and kicks off celery task to recalculate grades """ kwargs = { 'course_key': str(kwargs.get('course_key')), 'grading_policy_hash': str(kwargs.get('grading_policy_hash')), 'event_transaction_id': str(get_event_transaction_id()), 'event_transaction_type': str(get_event_transaction_type()), } result = task_compute_all_grades_for_course.apply_async(kwargs=kwargs, countdown=GRADING_POLICY_COUNTDOWN_SECONDS) log.info("Grades: Created {task_name}[{task_id}] with arguments {kwargs}".format( task_name=task_compute_all_grades_for_course.name, task_id=result.task_id, kwargs=kwargs, ))
def handle_grading_policy_changed(sender, **kwargs): # pylint: disable=unused-argument """ Receives signal and kicks off celery task to recalculate grades """ kwargs = { 'course_key': unicode(kwargs.get('course_key')), 'grading_policy_hash': unicode(kwargs.get('grading_policy_hash')), 'event_transaction_id': unicode(get_event_transaction_id()), 'event_transaction_type': unicode(get_event_transaction_type()), } result = task_compute_all_grades_for_course.apply_async(kwargs=kwargs, countdown=GRADING_POLICY_COUNTDOWN_SECONDS) log.info(u"Grades: Created {task_name}[{task_id}] with arguments {kwargs}".format( task_name=task_compute_all_grades_for_course.name, task_id=result.task_id, kwargs=kwargs, ))