def recalculateForStudent(self, request, *args, **kwargs):
        """Recalculates GCI Student Ranking for the specified student.

    Args in POST:
      key: The string version of the key for the GCIProfile entity
           representing the student.
    """
        post_dict = request.POST
        key = db.Key(post_dict['key'])
        student = GCIProfile.get(key)

        if not student:
            logging.warning(
                'Enqueued task to recalculate ranking for '
                'non-existent student %s', key)
            return responses.terminateTask()

        # get all the tasks that the student has completed
        q = GCITask.all()
        q.filter('student', student)
        q.filter('status', 'Closed')
        tasks = q.fetch(1000)

        score_logic.calculateRankingForStudent(student, tasks)

        return responses.terminateTask()
Exemple #2
0
  def recalculateForStudent(self, request, *args, **kwargs):
    """Recalculates GCI Student Ranking for the specified student.

    Args in POST:
      key: The string version of the key for the GCIProfile entity
           representing the student.
    """
    post_dict = request.POST
    key = db.Key(post_dict['key'])
    student = GCIProfile.get(key)

    if not student:
      logging.warning('Enqueued task to recalculate ranking for '
                      'non-existent student %s' %(key))
      return responses.terminateTask()

    # get all the tasks that the student has completed
    q = GCITask.all()
    q.filter('student', student)
    q.filter('status', 'Closed')
    tasks = q.fetch(1000)

    ranking_logic.calculateRankingForStudent(student, tasks)

    return responses.terminateTask()
Exemple #3
0
 def assertMailSentToSubscribers(self, comment):
   """Check if a notification email sent to the subscribers of the task.
   """
   subscribers = GCIProfile.get(self.task.subscribers)
   subject = DEF_NEW_TASK_COMMENT_SUBJECT % {
       'commented_by': comment.created_by.name,
       'program_name': self.task.program.name,
       'task_title': self.task.title
   }
   for subscriber in subscribers:
     self.assertEmailSent(bcc=subscriber.email, subject=subject)
Exemple #4
0
 def assertMailSentToSubscribers(self, comment):
     """Check if a notification email sent to the subscribers of the task.
 """
     subscribers = GCIProfile.get(self.task.subscribers)
     subject = DEF_NEW_TASK_COMMENT_SUBJECT % {
         "commented_by": comment.created_by.name,
         "program_name": self.task.program.name,
         "task_title": self.task.title,
     }
     for subscriber in subscribers:
         self.assertEmailSent(bcc=subscriber.email, subject=subject)