Пример #1
0
 def log_no_submissions(cls, submitted_activity, time_to_record=None):
     if time_to_record is None:
         time_to_record = current_utc_timestamp()
     d = {
         'activity_name': submitted_activity.name,
         'time': time_to_record,
         'message': 'No new submissions. No actions taken.'
     }
     cls.write(cls.entry_template.format(**d))
Пример #2
0
 def record_submission( self, time_to_record=None ):
     """
     Called to record the timestamp of when this student submitted
     their content unit
     :param time_to_record:
     :return:
     """
     if time_to_record is None:
         time_to_record = current_utc_timestamp()
     self.submitted = time_to_record
Пример #3
0
 def record_content_assignment_submission( self, submitted_time=None ):
     """
     Called to record the timestamp of when this student submitted
     their content unit
     :param submitted_time:
     :return:
     """
     if submitted_time is None:
         submitted_time = current_utc_timestamp()
     self.content_assignment_submitted = submitted_time
Пример #4
0
    def record_sent_results( self, time_to_record=None ):
        """
        Called to record the timestamp of when they were sent
        feedback on the unit
        :param time_to_record:
        :return:
        """

        if time_to_record is None:
            time_to_record = current_utc_timestamp()
        self.results = time_to_record
Пример #5
0
 def record_opened( self, time_to_record=None ):
     """
     Called to record the timestamp of when this student was
     notified that the activity_inviting_to_complete was available.
     With activities like peer review, this is also the
     time that they were sent someone else's work
     :param time_to_record:
     :return:
     """
     if time_to_record is None:
         time_to_record = current_utc_timestamp()
     self.notified = time_to_record
Пример #6
0
 def log_metareview_feedback_distributed(cls,
                                         assigned_activity,
                                         message,
                                         time_to_record=None):
     if time_to_record is None:
         time_to_record = current_utc_timestamp()
     d = {
         'activity_name': assigned_activity.name,
         'time': time_to_record,
         'message': message
     }
     cls.write(cls.entry_template.format(**d))
Пример #7
0
    def make_feedback_received_records( self, number, session=None ):
        session = session if session is not None else self.session
        self.previously_sent = [ ]

        for i in range( 0, number ):
            student_id = self.student_ids[ i ]
            rec = FeedbackReceivedRecord( student_id=student_id,
                                          activity_id=self.activity.id,
                                          sent_at=current_utc_timestamp() )
            session.add( rec )
            session.commit()
            self.previously_sent.append( student_id )

        self.assertEqual( number, len( self.previously_sent ), "dummy check" )
Пример #8
0
    def test_record_content_assignment_submission_date_provided(self):
        rec = ComplexStatusRecord(student_id=self.target_student.id,
                                  content_assignment_id=self.activity_id)
        self.assertTrue(rec.content_assignment_submitted is None)

        submission_ts = current_utc_timestamp()

        # call
        rec.record_content_assignment_submission(submission_ts)

        # check
        self.assertIsInstance(rec.content_assignment_submitted,
                              datetime.datetime)
        self.assertEqual(rec.content_assignment_submitted.tzinfo, pytz.utc,
                         "Timestamp is utc")
        self.assertEqual(rec.content_assignment_submitted, submission_ts,
                         "Passed-in timestamp set")
Пример #9
0
    def add_reviewee( self, reviewee, assigned_time=None ):
        """
        Sets the provided student as the person to be reviewed by
        the user whom the record belongs to.
        If assigned_time is set, it will use that as the reviewer_assigned_on value
        Otherwise will use current utc timestamp
        :param reviewee: Student object or id of student to be reviewed
        :param assigned_time:
        :return:
        """
        try:
            reviewee_id = reviewee.id
        except AttributeError:
            reviewee_id = reviewee

        if assigned_time is None:
            assigned_time = current_utc_timestamp()

        self.reviewer_assigned_on = assigned_time
        self.reviewer_of = reviewee_id
Пример #10
0
    def record(self, student, time_to_record=None):
        """
        Records that a student has submitted  an activity

        # todo Consider bulk commits if slow

        :param student: Student or student id
        :param time_to_record: If none, we will record the current utc time
        :return: SubmissionRecord
        """
        student_id = self._handle_id(student)
        if time_to_record is None:
            time_to_record = current_utc_timestamp()

        rec = SubmissionRecord(student_id=student_id,
                               activity_id=self.activity.id,
                               submitted_at=time_to_record)

        self.session.add(rec)
        self.session.commit()
        return rec
Пример #11
0
 def record_wait_notification( self, sent_time=None ):
     """Call to record that the student has been sent a notification that
     they will have to rest_timeout to receive student work for them to review"""
     if sent_time is None:
         sent_time = current_utc_timestamp()
     self.wait_notification_on = sent_time
Пример #12
0
 def record_sending_review_results( self, sent_time=None ):
     """Call to record that the student has been sent the content submitted
     by the reviewed_by student"""
     if sent_time is None:
         sent_time = current_utc_timestamp()
     self.review_results_on = sent_time
Пример #13
0
 def record_sending_metareview_results( self, sent_time=None ):
     """Called to record the feedback from the reviewer_of student being
     sent to this student"""
     if sent_time is None:
         sent_time = current_utc_timestamp()
     self.metareview_results_on = sent_time