diff options
author | rubenwardy <rw@rubenwardy.com> | 2019-11-16 00:05:35 +0000 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2019-11-16 00:05:35 +0000 |
commit | 20583784f597b82e2bca61f137780f1cefd50cc5 (patch) | |
tree | 6a6fd645630613d2b6647059ba73c3deadfabb1a | |
parent | 64f131ae27a7332245b5a4eb8e1e4879d7d99578 (diff) | |
download | cheatdb-20583784f597b82e2bca61f137780f1cefd50cc5.tar.xz |
Fix hardcoded progress bar in work queue, and related crash
-rw-r--r-- | app/templates/todo/list.html | 26 | ||||
-rw-r--r-- | app/templates/todo/topics.html | 24 |
2 files changed, 31 insertions, 19 deletions
diff --git a/app/templates/todo/list.html b/app/templates/todo/list.html index 2f09cb9..f9f90e0 100644 --- a/app/templates/todo/list.html +++ b/app/templates/todo/list.html @@ -101,17 +101,23 @@ <h2 class="mt-4">Unadded Topic List</h2> - <p> - {{ total_topics - topics_to_add }} / {{ total_topics }} packages have been been added to cdb, - based on cdb's forum parser. {{ topics_to_add }} remaining. - </p> + {% if total_topics > 0 %} + <p> + {{ total_topics - topics_to_add }} / {{ total_topics }} packages have been been added to cdb, + based on cdb's forum parser. {{ topics_to_add }} remaining. + </p> - <div class="progress my-4"> - {% set perc = 32 %} - <div class="progress-bar bg-success" role="progressbar" - style="width: {{ perc }}%" aria-valuenow="{{ perc }}" aria-valuemin="0" aria-valuemax="100"></div> - </div> + <div class="progress my-4"> + {% set perc = 100 * (total_topics - topics_to_add) / total_topics %} + <div class="progress-bar bg-success" role="progressbar" + style="width: {{ perc }}%" aria-valuenow="{{ perc }}" aria-valuemin="0" aria-valuemax="100"></div> + </div> - <a class="btn btn-primary" href="{{ url_for('todo.topics') }}">View Unadded Topic List</a> + <a class="btn btn-primary" href="{{ url_for('todo.topics') }}">View Unadded Topic List</a> + {% else %} + <p> + The forum topic crawler needs to run at least once for this section to work. + </p> + {% endif %} {% endblock %} diff --git a/app/templates/todo/topics.html b/app/templates/todo/topics.html index 8afa3b0..e51f4ec 100644 --- a/app/templates/todo/topics.html +++ b/app/templates/todo/topics.html @@ -51,15 +51,21 @@ Topics to be Added <h1>Topics to be Added</h1> - <p> - {{ total - topic_count }} / {{ total }} topics have been added as packages to CDB. - {{ topic_count }} remaining. - </p> - <div class="progress"> - {% set perc = 100 * (total - topic_count) / total %} - <div class="progress-bar bg-success" role="progressbar" - style="width: {{ perc }}%" aria-valuenow="{{ perc }}" aria-valuemin="0" aria-valuemax="100"></div> - </div> + {% if topic_count > 0 %} + <p> + {{ total - topic_count }} / {{ total }} topics have been added as packages to CDB. + {{ topic_count }} remaining. + </p> + <div class="progress"> + {% set perc = 100 * (total - topic_count) / total %} + <div class="progress-bar bg-success" role="progressbar" + style="width: {{ perc }}%" aria-valuenow="{{ perc }}" aria-valuemin="0" aria-valuemax="100"></div> + </div> + {% else %} + <p> + The forum topic crawler needs to run at least once for this section to work. + </p> + {% endif %} <form method="GET" action="{{ url_for('todo.topics') }}" class="my-4"> <input type="hidden" name="show_discarded" value={{ show_discarded and "True" or "False" }} /> |