]> git.lizzy.rs Git - cheatdb.git/commitdiff
Fix hardcoded progress bar in work queue, and related crash
authorrubenwardy <rw@rubenwardy.com>
Sat, 16 Nov 2019 00:05:35 +0000 (00:05 +0000)
committerrubenwardy <rw@rubenwardy.com>
Sat, 16 Nov 2019 00:05:35 +0000 (00:05 +0000)
app/templates/todo/list.html
app/templates/todo/topics.html

index 2f09cb9b6e994983fa9f58dbb5df498228ebfef3..f9f90e0748cf3526a9c08b15a20283d9d5418cd8 100644 (file)
 
        <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 %}
index 8afa3b0c16eda2fdc59d06a4c0e2f73ef3b4a6c2..e51f4ec4e0b317584b49759723cb8bef793de283 100644 (file)
@@ -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" }} />