Ejemplo n.º 1
0
 def _get_urls_of_tasks(self, *metric_source_ids: str,
                        get_tasks: callable, referent_date: callable) -> List[Tuple[str, str, str]]:
     """ Return the urls for the inactive actions. """
     urls = list()
     tasks = get_tasks(*metric_source_ids)
     if tasks:
         dt_now = datetime.datetime.now()
         for task in tasks:
             time_delta = utils.format_timedelta(
                 dt_now - utils.parse_iso_datetime_local_naive(referent_date(task)))
             urls.append((self.__task_display_url.format(task_id=task['id']), task['title'], time_delta))
     return urls
Ejemplo n.º 2
0
 def inactive_actions_url(self, *board_ids: str, days: int = 14, now: DateTime = None) -> List[Tuple[str, str, str]]:
     """ Return the urls for the inactive cards. """
     if not self.__boards(*board_ids):
         return list()
     now = now or datetime.datetime.now()
     inactive_cards = list(self.__inactive_cards(*board_ids, days=days, now=now))
     if not inactive_cards:
         return list()
     urls = list()
     for card in inactive_cards:
         time_delta = utils.format_timedelta(now - self.__last_activity(card.get_card_info()))
         urls.append((self.__card_url(card), card.id, time_delta))
     return urls
Ejemplo n.º 3
0
 def over_due_actions_url(self, *board_ids: str, now: DateTime = None) -> List[Tuple[str, str, str]]:
     """ Return the urls to the over due cards. """
     if not self.__boards(*board_ids):
         return list()
     now = now or datetime.datetime.now()
     over_due_cards = list(self.__over_due_cards(*board_ids, now=now))
     if not over_due_cards:
         return list()
     urls = list()
     for card in over_due_cards:
         time_delta = utils.format_timedelta(now - self.__due_date(card.get_card_info()))
         urls.append((self.__card_url(card), card.id, time_delta))
     return urls
 def _get_urls_of_tasks(
         self, *metric_source_ids: str, get_tasks: callable,
         referent_date: callable) -> List[Tuple[str, str, str]]:
     """ Return the urls for the inactive actions. """
     urls = list()
     tasks = get_tasks(*metric_source_ids)
     if tasks:
         dt_now = datetime.datetime.now()
         for task in tasks:
             time_delta = utils.format_timedelta(
                 dt_now -
                 utils.parse_iso_datetime_local_naive(referent_date(task)))
             urls.append(
                 (self.__task_display_url.format(task_id=task['id']),
                  task['title'], time_delta))
     return urls
Ejemplo n.º 5
0
 def over_due_actions_url(
         self,
         *board_ids: str,
         now: DateTime = None) -> List[Tuple[str, str, str]]:
     """ Return the urls to the over due cards. """
     if not self.__boards(*board_ids):
         return list()
     now = now or datetime.datetime.now()
     over_due_cards = list(self.__over_due_cards(*board_ids, now=now))
     if not over_due_cards:
         return list()
     urls = list()
     for card in over_due_cards:
         time_delta = utils.format_timedelta(
             now - self.__due_date(card.get_card_info()))
         urls.append((self.__card_url(card), card.id, time_delta))
     return urls
Ejemplo n.º 6
0
 def inactive_actions_url(
         self,
         *board_ids: str,
         days: int = 14,
         now: DateTime = None) -> List[Tuple[str, str, str]]:
     """ Return the urls for the inactive cards. """
     if not self.__boards(*board_ids):
         return list()
     now = now or datetime.datetime.now()
     inactive_cards = list(
         self.__inactive_cards(*board_ids, days=days, now=now))
     if not inactive_cards:
         return list()
     urls = list()
     for card in inactive_cards:
         time_delta = utils.format_timedelta(
             now - self.__last_activity(card.get_card_info()))
         urls.append((self.__card_url(card), card.id, time_delta))
     return urls
Ejemplo n.º 7
0
 def __get_formatted_time_delta(cls, date_to_parse) -> str:
     return utils.format_timedelta(datetime.datetime.now().astimezone() - dateutil.parser.parse(date_to_parse))
Ejemplo n.º 8
0
 def __get_formatted_time_delta(cls, date_to_parse) -> str:
     return utils.format_timedelta(datetime.datetime.now().astimezone() -
                                   dateutil.parser.parse(date_to_parse))
Ejemplo n.º 9
0
 def assert_format(self, formatted_time_delta, **time_delta_args):
     """ Check that the time delta is formatted correctly. """
     self.assertEqual(formatted_time_delta, utils.format_timedelta(datetime.timedelta(**time_delta_args)))