Example #1
0
 def get_start_end():
     """
     Récupère les valeurs de début et fin des data en fonction des settings
     :return: Un tuple (début, fin)
     """
     start_ts = 0
     end_ts = 0
     if settings_stat_store.week_ago >= 0:
         start_ts = timestamp_at_week_ago(settings_stat_store.week_ago)
         if settings_stat_store.week_ago == 0:
             end_ts = timestamp_now()
         else:
             end_ts = timestamp_at_week_ago(settings_stat_store.week_ago -
                                            1)
     if settings_stat_store.month_ago >= 0:
         start_ts = timestamp_at_month_ago(settings_stat_store.month_ago)
         if settings_stat_store.month_ago == 0:
             end_ts = timestamp_now()
         else:
             end_ts = timestamp_at_month_ago(settings_stat_store.month_ago -
                                             1)
     if settings_stat_store.year_ago >= 0:
         start_ts = timestamp_at_year_ago(settings_stat_store.year_ago)
         if settings_stat_store.year_ago == 0:
             end_ts = timestamp_now()
         else:
             end_ts = timestamp_at_year_ago(settings_stat_store.month_ago -
                                            1)
     return start_ts, end_ts
 def add_defaut_day(self):
     start_week = timestamp_at_week_ago(self.week_ago)
     start_next_week = timestamp_at_week_ago(self.week_ago - 1)
     ts_day_ago = start_week
     while ts_day_ago <= start_next_week:
         if is_weekend(ts_day_ago):
             break
         else:
             Database.add_defaut_day(ts_day_ago)
         ts_day_ago += 86400
 def add_data(self):
     self.current_data = []
     all_data = Database.get_team_gestion()
     for data in all_data:
         start_day = data[0]
         start_week = timestamp_at_week_ago(
             settings_team_gestion_store.week_ago)
         start_next_week = timestamp_at_week_ago(
             settings_team_gestion_store.week_ago - 1)
         if start_week <= start_day < start_next_week:
             self.current_data.append(data)
Example #4
0
 def update_param(self):
     if self.week_ago >= 0:
         self.time_stat = timestamp_to_week(timestamp_at_week_ago(self.week_ago)).capitalize()
     if self.month_ago >= 0:
         self.time_stat = timestamp_to_month(timestamp_at_month_ago(self.month_ago)).capitalize()
     if self.year_ago >= 0:
         self.time_stat = timestamp_to_year(timestamp_at_year_ago(self.year_ago))
     self.get_format()
Example #5
0
 def update_button(self):
     disabled_bt_moins = False
     disabled_bt_plus = False
     if settings_team_gestion_store.week_ago >= LIMIT_JOURS_GESTION_EQUIPE:
         disabled_bt_plus = True
     limit_week_stat = 1508709600
     if timestamp_at_week_ago(
             settings_team_gestion_store.week_ago) == limit_week_stat:
         disabled_bt_moins = True
     self.bt_moins.setDisabled(disabled_bt_moins)
     self.bt_plus.setDisabled(disabled_bt_plus)
Example #6
0
 def update_button(self):
     self.bt_plus.setEnabled(settings_stat_store.week_ago > 0
                             or settings_stat_store.month_ago > 0)
     disabled_bt_moins = False
     limit_week_stat = 1508709600 if settings_stat_store.data_type == "métrage" else 1514761200
     if timestamp_at_week_ago(
             settings_stat_store.week_ago
     ) == limit_week_stat and settings_stat_store.week_ago >= 0:
         disabled_bt_moins = True
     limit_month_stat = 1509490800 if settings_stat_store.data_type == "métrage" else 1514761200
     if timestamp_at_month_ago(settings_stat_store.month_ago) == limit_month_stat \
             and settings_stat_store.month_ago >= 0:
         disabled_bt_moins = True
     limit_year_stat = 1514761200
     if timestamp_at_year_ago(settings_stat_store.year_ago) == limit_year_stat \
             and settings_stat_store.year_ago >= 0:
         disabled_bt_moins = True
     self.bt_moins.setDisabled(disabled_bt_moins)
 def update_param(self):
     self.time_stat = timestamp_to_week(timestamp_at_week_ago(
         self.week_ago)).capitalize()
 def __init__(self):
     super(SettingsTeamGestionStore, self).__init__()
     self.week_ago = 0
     self.add_defaut_day()
     self.time_stat = timestamp_to_week(timestamp_at_week_ago(
         self.week_ago)).capitalize()