def can_issue_daily(self):
"""
``Report`` can issue ``DailyReport`` if and only if
- occurs today ( hence ``get_daily`` ),
- daily hasn't been issued yet for day,
- members list is not empty,
- questions list is not empty.
:return: whether daily report can be generated
:rtype: bool
"""
already_issued = self.dailyreport_set.filter(date=date.today()).exists()
group_not_empty = self.team.users.exists()
questions_not_empty = self.question_set.filter(active=True).exists()
return all([self.occurs_today,
group_not_empty,
questions_not_empty,
self.survey_send_time <= now().time(),
not already_issued])
评论列表
文章目录