Exemple #1
0
  def context(self):
    """Returns the context for the current template.
    """
    task = self.data.task
    mentors = [m.public_name for m in db.get(task.mentors)]
    profile = self.data.profile

    # We count everyone from the org as a mentor, the mentors property
    # is just who best to contact about this task
    context = {
        'task': task,
        'mentors': mentors,
        'is_mentor': self.data.mentorFor(task.org),
        'is_task_mentor': profile.key() in task.mentors if profile else None,
        'is_owner': task_logic.isOwnerOfTask(task, self.data.profile),
        'is_claimed': task.status in ACTIVE_CLAIMED_TASK,
        'profile': self.data.profile,
    }

    if task.deadline:
      rdays, rhrs, rmins = timeline_helper.remainingTimeSplit(task.deadline)
      context['remaining_days'] = rdays
      context['remaining_hours'] = rhrs
      context['remaining_minutes'] = rmins

    self.setButtonControls(context)

    return context
Exemple #2
0
    def context(self):
        """Returns the context for the current template.
    """
        task = self.data.task
        mentors = [
            mentor.public_name for mentor in ndb.get_multi(
                map(ndb.Key.from_old_key, task.mentors))
        ]
        profile = self.data.ndb_profile

        # We count everyone from the org as a mentor, the mentors property
        # is just who best to contact about this task
        context = {
            'task':
            task,
            'mentors':
            mentors,
            'is_mentor':
            self.data.mentorFor(
                task_model.GCITask.org.get_value_for_datastore(task)),
            'is_task_mentor':
            profile.key.to_old_key() in task.mentors if profile else None,
            'is_owner':
            task_logic.isOwnerOfTask(task, self.data.ndb_profile),
            'is_claimed':
            task.status in ACTIVE_CLAIMED_TASK,
            'profile':
            self.data.ndb_profile,
        }

        if task.deadline:
            rdays, rhrs, rmins = timeline_helper.remainingTimeSplit(
                task.deadline)
            context['remaining_days'] = rdays
            context['remaining_hours'] = rhrs
            context['remaining_minutes'] = rmins

        self.setButtonControls(context)

        return context
Exemple #3
0
 def tasksVisibleInTime(self):
   """Returns the remaining time till the tasks are publicly visible to
   the students.
   """
   end = self.tasksPubliclyVisibleOn()
   return timeline_helper.remainingTimeSplit(end)
Exemple #4
0
 def remainingTime(self):
   """Returns the remaining time in the program a tuple of days, hrs and mins.
   """
   end = self.stopAllWorkOn()
   return timeline_helper.remainingTimeSplit(end)
Exemple #5
0
 def tasksVisibleInTime(self):
     """Returns the remaining time till the tasks are publicly visible to
 the students.
 """
     end = self.tasksPubliclyVisibleOn()
     return timeline_helper.remainingTimeSplit(end)
Exemple #6
0
 def remainingTime(self):
     """Returns the remaining time in the program a tuple of days, hrs and mins.
 """
     end = self.stopAllWorkOn()
     return timeline_helper.remainingTimeSplit(end)