stats update

This commit is contained in:
Administrator
2023-10-03 20:43:56 +03:00
parent 14918f18a7
commit 4bf77ff3af
2 changed files with 11 additions and 2 deletions

View File

@@ -14,19 +14,22 @@ class StatsView(BaseView):
required_login = True
def get(self):
count = 20
count = 12
snapshots = list(Snapshot.objects.filter(project=self.request.user.selected_project).order_by('-created_at')[:count])
keys = set()
for snapshot in snapshots:
for key in snapshot.data:
keys.add(key)
keys = list(keys)
keys.sort()
rows = [[key] for key in keys]
times = []
for snapshot in snapshots:
times.append(snapshot.created_at)
for index, key in enumerate(keys):
rows[index].append(snapshot.data.get(key))
self.context['keys'] = keys
self.context['data'] = rows
self.context['times'] = times
self.context['err'] = 'err' in self.request.GET
def post(self):