Пример #1
0
    def get_action_items(self):
        # Avoid circular dependency
        from remo.base.templatetags.helpers import user_is_rep
        from remo.dashboard.models import Item
        ActionItem = get_model('dashboard', 'ActionItem')

        if not self.assigned_to or not user_is_rep(self.assigned_to):
            return []

        action_items = []
        actions = [
            (_get_action_name(ADD_RECEIPTS_ACTION,
                              self), 'waiting_receipts', ActionItem.NORMAL),
            (_get_action_name(ADD_REPORT_ACTION,
                              self), 'waiting_report', ActionItem.NORMAL),
            (_get_action_name(ADD_PHOTOS_ACTION,
                              self), 'waiting_photos', ActionItem.NORMAL),
            (_get_action_name(ADD_REPORTS_PHOTOS_ACTION, self),
             'waiting_report_photos', ActionItem.NORMAL),
            (_get_action_name(REVIEW_BUDGET_REQUEST_ACTION, self),
             'council_member_assigned', ActionItem.BLOCKER)
        ]

        for action_name, attr, priority in actions:
            if getattr(self, attr, None):
                action_item = Item(action_name, self.assigned_to, priority,
                                   None)
                action_items.append(action_item)

        mentor_action = _get_action_name(WAITING_MENTOR_VALIDATION_ACTION,
                                         self)
        if self.assigned_to and user_is_rep(self.assigned_to):
            mentor = self.assigned_to
            if self.pending_mentor_validation:
                action_item = Item(mentor_action, mentor, ActionItem.BLOCKER,
                                   None)
                action_items.append(action_item)

        action_name = _get_action_name(NEEDINFO_ACTION, self)
        for user in self.budget_needinfo.all():
            action_item = Item(action_name, user, ActionItem.CRITICAL, None)
            action_items.append(action_item)

        return action_items
Пример #2
0
    def get_action_items(self):
        """Return a list of Action Items relevant to this model."""

        today = timezone.now().date()
        due_date = datetime.date(today.year, today.month, NOMINATION_END_DAY)
        name = u'{0} {1}'.format(NOMINATION_ACTION_ITEM, today.strftime('%B'))
        priority = ActionItem.NORMAL
        action_item = Item(name, self.user, priority, due_date)

        return [action_item]
Пример #3
0
    def get_action_items(self):
        action_items = []

        # Get action items for post event metrics
        outcome = self.eventmetricoutcome_set.filter(outcome__isnull=False)
        if self.is_past_event and not outcome and self.has_new_metrics:
            name = u'{0} {1}'.format(POST_EVENT_METRICS_ACTION, self.name)
            action_item = Item(name, self.owner, ActionItem.NORMAL, None)
            action_items.append(action_item)
        return action_items
Пример #4
0
    def get_action_items(self):
        """Returns a list of action items.

        An action item is returned in the case that an activity needs
        verification from the mentor of a user.
        """

        action_items = []
        if self.activity.is_verifiable and not self.verified_activity:
            due_date = get_date(weeks=VERIFY_ACTIVITY_WEEKS)
            name = u'{0} {1}'.format(VERIFY_ACTION, self.user.get_full_name())
            priority = ActionItem.NORMAL
            action_items.append(Item(name, self.mentor, priority, due_date))
        return action_items
Пример #5
0
    def get_action_items(self):
        action_items = []
        due_date = self.end.date()

        if self.automated_poll:
            name = u'{0} {1}'.format(BUDGET_VOTE_ACTION, self.bug.summary)
            priority = ActionItem.MAJOR
        else:
            name = u'{0} {1}'.format(VOTE_ACTION, self.name)
            priority = ActionItem.NORMAL

        for user in User.objects.filter(groups=self.valid_groups):
            action_item = Item(name, user, priority, due_date)
            action_items.append(action_item)

        return action_items
Пример #6
0
    def get_action_items(self):
        action_items = []
        due_date = self.end.date()

        if self.automated_poll:
            name = u'{0} {1}'.format(BUDGET_VOTE_ACTION, self.bug.summary)
            priority = ActionItem.MAJOR
        else:
            name = u'{0} {1}'.format(VOTE_ACTION, self.name)
            priority = ActionItem.NORMAL

        # Exclude the users that already have voted
        users = User.objects.filter(groups=self.valid_groups).exclude(
            pk__in=self.vote_set.values_list('user', flat=True))
        for user in users:
            action_item = Item(name, user, priority, due_date)
            action_items.append(action_item)

        return action_items