Пример #1
0
def dashboard_item_update_task_params(
    item: DashboardItem, dashboard: Optional[Dashboard] = None
) -> Tuple[str, CacheType, Dict]:
    filter = get_filter(data=item.dashboard_filters(dashboard), team=item.team)
    cache_key = generate_cache_key("{}_{}".format(filter.toJSON(), item.team_id))

    cache_type = get_cache_type(filter)
    payload = {"filter": filter.toJSON(), "team_id": item.team_id}

    return cache_key, cache_type, payload
Пример #2
0
 def get_last_refresh(self, dashboard_item: DashboardItem):
     if self.get_result(dashboard_item):
         return dashboard_item.last_refresh
     dashboard_item.last_refresh = None
     dashboard_item.save()
     return None