# HG changeset patch # User Mads Kiilerich # Date 2020-01-02 23:00:36 # Node ID bf009cb3a4701527ffb156b291828e62ec784fd3 # Parent 7aff9d527bf147488e25e8fb89dd54687fee93b6 summary: drop no_data in all possible ways The controllers some odd "is" checks did and removed has been. The javascript variables were never used. summary.html didn't use no_data at all. The only real use was in statistics.html ... where it seems like a better fit to just use c.stats_percentage . diff --git a/kallithea/controllers/summary.py b/kallithea/controllers/summary.py --- a/kallithea/controllers/summary.py +++ b/kallithea/controllers/summary.py @@ -138,7 +138,6 @@ class SummaryController(BaseRepoControll c.stats_percentage = 0 if stats and stats.languages: - c.no_data = False is c.db_repo.enable_statistics lang_stats_d = ext_json.loads(stats.languages) lang_stats = [(x, {"count": y, @@ -148,7 +147,6 @@ class SummaryController(BaseRepoControll c.trending_languages = lang_stats[:10] else: - c.no_data = True c.trending_languages = [] c.enable_downloads = c.db_repo.enable_downloads @@ -190,7 +188,6 @@ class SummaryController(BaseRepoControll .scalar() c.stats_percentage = 0 if stats and stats.languages: - c.no_data = False is c.db_repo.enable_statistics lang_stats_d = ext_json.loads(stats.languages) c.commit_data = ext_json.loads(stats.commit_activity) c.overview_data = ext_json.loads(stats.commit_activity_combined) @@ -213,8 +210,7 @@ class SummaryController(BaseRepoControll else: c.commit_data = {} c.overview_data = ([[ts_min_y, 0], [ts_max_y, 10]]) - c.trending_languages = {} - c.no_data = True + c.trending_languages = [] recurse_limit = 500 # don't recurse more than 500 times when parsing get_commits_stats(c.db_repo.repo_name, ts_min_y, ts_max_y, recurse_limit) diff --git a/kallithea/templates/summary/statistics.html b/kallithea/templates/summary/statistics.html --- a/kallithea/templates/summary/statistics.html +++ b/kallithea/templates/summary/statistics.html @@ -28,8 +28,8 @@ ${self.repo_context_bar('summary')}
-
- %if c.no_data: +
+ %if not c.stats_percentage: ${c.no_data_msg} %if h.HasPermissionAny('hg.admin')('enable stats on from summary'): ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name),class_="btn btn-default btn-xs")} @@ -54,7 +54,6 @@ ${self.repo_context_bar('summary')}