From dc1db5006c92572fe4481260e78681c5aee786ba Mon Sep 17 00:00:00 2001 From: George Lacey Date: Tue, 18 May 2021 21:14:33 +0100 Subject: [PATCH] Shorten hourly string --- borgweb/borg/models/repo.py | 8 ++++---- borgweb/borg/static/js/index.js | 2 +- borgweb/borg/views.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/borgweb/borg/models/repo.py b/borgweb/borg/models/repo.py index d9c9d78..607bdf7 100644 --- a/borgweb/borg/models/repo.py +++ b/borgweb/borg/models/repo.py @@ -94,7 +94,7 @@ class Repo(models.Model): days.append(len(cday_archives) > 0) return days - def daily_dict(self, units, n_hours: int = 24): + def daily_dict(self, units, n_hours: int = 7): archives = self.daily_archives(n_hours) return { "id": self.id, @@ -120,7 +120,7 @@ class Repo(models.Model): return ''.join(['H' if archive is not None else '-' for archive in archives]) def hourly_archive_string(self): - return ''.join(['H' if archive is not None else '-' for archive in self.hourly_archives(48)]) + return ''.join(['H' if archive is not None else '-' for archive in self.hourly_archives(8)]) def monthly_archives(self, n_months: int = 12): archives = [] @@ -139,7 +139,7 @@ class Repo(models.Model): archives.append(None) return archives - def daily_archives(self, n_days: int = 24): + def daily_archives(self, n_days: int = 7): archives = [] for day in range(n_days): current_date = (datetime.utcnow() - timedelta(days=day)).date() @@ -152,7 +152,7 @@ class Repo(models.Model): archives.append(None) return archives - def hourly_archives(self, n_hours: int = 24): + def hourly_archives(self, n_hours: int = 8): archives = [] for hour in range(n_hours): current_hour = datetime.utcnow() - timedelta(hours=hour) diff --git a/borgweb/borg/static/js/index.js b/borgweb/borg/static/js/index.js index 6b56b98..9f82a0e 100644 --- a/borgweb/borg/static/js/index.js +++ b/borgweb/borg/static/js/index.js @@ -1,6 +1,6 @@ window.addEventListener("DOMContentLoaded", function () { const repoDict = JSON.parse(document.getElementById('hour_list').textContent); - set_daily_graph(repoDict) + // set_daily_graph(repoDict) }, false); function set_daily_graph(repoDict) { diff --git a/borgweb/borg/views.py b/borgweb/borg/views.py index 2814433..66be122 100644 --- a/borgweb/borg/views.py +++ b/borgweb/borg/views.py @@ -14,7 +14,7 @@ def index(request): repo_list = Repo.objects.all() location_list = Location.objects.all() - # repo_dict = repo_daily_dict(repo_list, 24) + # repo_dict = repo_daily_dict(repo_list, 8) context = { 'repo_list': repo_list,