From 9308a912850c1f2d33b55bea287dbd682d3aaeec Mon Sep 17 00:00:00 2001
From: Gaurav Kumar <aavrug@gmail.com>
Date: Jan 05 2017 13:24:55 +0000
Subject: [PATCH 1/4] Updated issues progress bar count status.


---

diff --git a/pagure/templates/issues.html b/pagure/templates/issues.html
index 66b73ad..de15abe 100644
--- a/pagure/templates/issues.html
+++ b/pagure/templates/issues.html
@@ -12,9 +12,9 @@
 
   <h2>
     {% if status|lower in ['open', 'true'] %}
-      {{ issues|count }} Open Issues (of {{ issues_cnt }})
+      {{ issues|count }} Open Issues (of {{ total_issues_cnt }})
     {% elif status|lower not in ['open', 'true', 'all', 'none'] %}
-      {{ issues|count }} Closed Issues (of {{ issues_cnt }})
+      {{ issues|count }} Closed Issues (of {{ total_issues_cnt }})
     {% else %}
       {{ issues|count }} Issues
     {% endif %}
@@ -51,8 +51,8 @@
     {% if oth_issues %}
     <div class="addrem_bar issues_pbar m-b-1">
       {% if (issues | length + oth_issues) %}
-        <span style="width: {{ (100.0 * (1 - issues_cnt / (issues_cnt + oth_issues)))|round|int }}%">
-            {{ (100.0 * (1 - issues_cnt / (issues_cnt + oth_issues)))|round|int }}%
+        <span style="width: {{ (100.0 * (issues_cnt / total_issues_cnt))|round|int }}%">
+            {{ (100.0 * (issues_cnt / total_issues_cnt))|round|int }}%
         </span>
       {% endif %}
     </div>
diff --git a/pagure/ui/issues.py b/pagure/ui/issues.py
index e611fc0..0e385c2 100644
--- a/pagure/ui/issues.py
+++ b/pagure/ui/issues.py
@@ -506,6 +506,9 @@ def view_issues(repo, username=None, namespace=None):
         status = None
 
     oth_issues = None
+    total_issues_cnt = pagure.lib.search_issues(
+            SESSION, repo, tags=tags, assignee=assignee,
+            author=author, private=private, priority=priority, count=True)
     if status is not None:
         issues = pagure.lib.search_issues(
             SESSION,
@@ -557,9 +560,7 @@ def view_issues(repo, username=None, namespace=None):
             search_pattern=search_pattern,
             custom_search=custom_search,
         )
-        issues_cnt = pagure.lib.search_issues(
-            SESSION, repo, tags=tags, assignee=assignee,
-            author=author, private=private, priority=priority, count=True)
+        issues_cnt = total_issues_cnt
 
     tag_list = pagure.lib.get_tags_of_project(SESSION, repo)
 
@@ -574,6 +575,7 @@ def view_issues(repo, username=None, namespace=None):
         status=status,
         issues=issues,
         issues_cnt=issues_cnt,
+        total_issues_cnt=total_issues_cnt,
         oth_issues=oth_issues,
         tags=tags,
         assignee=assignee,

From 0550b338fd60fb33b7bd071ecc42f72843ef421b Mon Sep 17 00:00:00 2001
From: Gaurav Kumar <aavrug@gmail.com>
Date: Jan 05 2017 13:24:55 +0000
Subject: [PATCH 2/4] Modifications for progress bar percentage.


---

diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css
index 1941395..a8abce1 100644
--- a/pagure/static/pagure.css
+++ b/pagure/static/pagure.css
@@ -488,11 +488,19 @@ a.notblue:hover {
     background-color: #FDD;
 }
 
+.addrem_bar.closed {
+    background-color: #DBFFDB;
+}
+
 .addrem_bar > span {
     display: block;
     background-color: #DBFFDB;
 }
 
+.addrem_bar.closed > span {
+    background-color: #FDD;
+}
+
 .comment_body img {
     max-width: 100%;
     border: 5px solid #fff;
diff --git a/pagure/templates/issues.html b/pagure/templates/issues.html
index de15abe..f12ac27 100644
--- a/pagure/templates/issues.html
+++ b/pagure/templates/issues.html
@@ -12,9 +12,9 @@
 
   <h2>
     {% if status|lower in ['open', 'true'] %}
-      {{ issues|count }} Open Issues (of {{ total_issues_cnt }})
+      {{ issues|count }} Open Issues (of {{ issues_cnt }})
     {% elif status|lower not in ['open', 'true', 'all', 'none'] %}
-      {{ issues|count }} Closed Issues (of {{ total_issues_cnt }})
+      {{ issues|count }} Closed Issues (of {{ issues_cnt }})
     {% else %}
       {{ issues|count }} Issues
     {% endif %}
@@ -49,9 +49,9 @@
     </span>
   </h2>
     {% if oth_issues %}
-    <div class="addrem_bar issues_pbar m-b-1">
+    <div class="addrem_bar issues_pbar m-b-1 {% if status|lower not in ['open', 'true'] %}closed{% endif %}" title="{{ (100.0 * (oth_issues_cnt / total_issues_cnt))|round|int }}% of {% if status|lower in ['open', 'true'] %}closed{% else %}open{% endif %} issues on {{ total_issues_cnt }} issues in total">
       {% if (issues | length + oth_issues) %}
-        <span style="width: {{ (100.0 * (issues_cnt / total_issues_cnt))|round|int }}%">
+        <span style="width: {{ (100.0 * (issues_cnt / total_issues_cnt))|round|int }}%" title="{{ (100.0 * (issues_cnt / total_issues_cnt))|round|int }}% of {% if status|lower in ['open', 'true'] %}open{% else %}closed{% endif %} issues on {{ total_issues_cnt }} issues in total">
             {{ (100.0 * (issues_cnt / total_issues_cnt))|round|int }}%
         </span>
       {% endif %}
diff --git a/pagure/ui/issues.py b/pagure/ui/issues.py
index 0e385c2..fe9ba1c 100644
--- a/pagure/ui/issues.py
+++ b/pagure/ui/issues.py
@@ -506,6 +506,7 @@ def view_issues(repo, username=None, namespace=None):
         status = None
 
     oth_issues = None
+    oth_issues_cnt = None
     total_issues_cnt = pagure.lib.search_issues(
             SESSION, repo, tags=tags, assignee=assignee,
             author=author, private=private, priority=priority, count=True)
@@ -552,6 +553,7 @@ def view_issues(repo, username=None, namespace=None):
             search_pattern=search_pattern,
             custom_search=custom_search,
         )
+        oth_issues_cnt = total_issues_cnt ^ issues_cnt
     else:
         issues = pagure.lib.search_issues(
             SESSION, repo, tags=tags, assignee=assignee,
@@ -577,6 +579,7 @@ def view_issues(repo, username=None, namespace=None):
         issues_cnt=issues_cnt,
         total_issues_cnt=total_issues_cnt,
         oth_issues=oth_issues,
+        oth_issues_cnt=oth_issues_cnt,
         tags=tags,
         assignee=assignee,
         author=author,

From ecae417fa2a4d073616b174a6f79ee3cd9c5f2b7 Mon Sep 17 00:00:00 2001
From: Gaurav Kumar <aavrug@gmail.com>
Date: Jan 05 2017 13:24:55 +0000
Subject: [PATCH 3/4] Replace XOR operator with minus.


---

diff --git a/pagure/ui/issues.py b/pagure/ui/issues.py
index fe9ba1c..537c968 100644
--- a/pagure/ui/issues.py
+++ b/pagure/ui/issues.py
@@ -553,7 +553,7 @@ def view_issues(repo, username=None, namespace=None):
             search_pattern=search_pattern,
             custom_search=custom_search,
         )
-        oth_issues_cnt = total_issues_cnt ^ issues_cnt
+        oth_issues_cnt = total_issues_cnt - issues_cnt
     else:
         issues = pagure.lib.search_issues(
             SESSION, repo, tags=tags, assignee=assignee,

From ee954e0900c3f47e048ca8d8aa656186a909b0c2 Mon Sep 17 00:00:00 2001
From: Gaurav Kumar <aavrug@gmail.com>
Date: Jan 05 2017 13:27:12 +0000
Subject: [PATCH 4/4] Fixed indentation.


---

diff --git a/pagure/templates/issues.html b/pagure/templates/issues.html
index f12ac27..0d358bc 100644
--- a/pagure/templates/issues.html
+++ b/pagure/templates/issues.html
@@ -49,9 +49,20 @@
     </span>
   </h2>
     {% if oth_issues %}
-    <div class="addrem_bar issues_pbar m-b-1 {% if status|lower not in ['open', 'true'] %}closed{% endif %}" title="{{ (100.0 * (oth_issues_cnt / total_issues_cnt))|round|int }}% of {% if status|lower in ['open', 'true'] %}closed{% else %}open{% endif %} issues on {{ total_issues_cnt }} issues in total">
+    <div class="addrem_bar issues_pbar m-b-1 {%
+      if status|lower not in ['open', 'true'] %}closed{%
+      endif %}" title="{{
+      (100.0 * (oth_issues_cnt / total_issues_cnt))|round|int }}% of {%
+      if status|lower in ['open', 'true'] %}closed{%
+      else %}open{%
+      endif %} issues on {{ total_issues_cnt }} issues in total">
       {% if (issues | length + oth_issues) %}
-        <span style="width: {{ (100.0 * (issues_cnt / total_issues_cnt))|round|int }}%" title="{{ (100.0 * (issues_cnt / total_issues_cnt))|round|int }}% of {% if status|lower in ['open', 'true'] %}open{% else %}closed{% endif %} issues on {{ total_issues_cnt }} issues in total">
+        <span style="width: {{
+          (100.0 * (issues_cnt / total_issues_cnt))|round|int }}%" title="{{
+          (100.0 * (issues_cnt / total_issues_cnt))|round|int }}% of {%
+          if status|lower in ['open', 'true'] %}open{%
+          else %}closed{%
+          endif %} issues on {{ total_issues_cnt }} issues in total">
             {{ (100.0 * (issues_cnt / total_issues_cnt))|round|int }}%
         </span>
       {% endif %}

