summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-07-06 22:54:07 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-07-06 22:54:07 +0200
commit5fe8f5636768201db4703124aefd1378871c8429 (patch)
tree44e85f6f622ef8a0e0494f628f04bb58639d603a
parent704a61184e9d87d0aad33b5f830e075dd7da9e4d (diff)
downloadhemiptera-5fe8f5636768201db4703124aefd1378871c8429.zip
hemiptera-5fe8f5636768201db4703124aefd1378871c8429.tar.gz
hemiptera-5fe8f5636768201db4703124aefd1378871c8429.tar.bz2
solve #8, #16
-rw-r--r--hemiptera_html.py12
-rw-r--r--templates/main_page.html5
2 files changed, 12 insertions, 5 deletions
diff --git a/hemiptera_html.py b/hemiptera_html.py
index 6596c13..394608a 100644
--- a/hemiptera_html.py
+++ b/hemiptera_html.py
@@ -54,9 +54,10 @@ def create_project_list() :
for i in os.listdir(opj(basedir, "projects")) :
k = Project()
k.name = i
- k.count = len(os.listdir(opj(basedir, "projects", i))) -1
+
projects.append(k)
bugs =[]
+ k.bugs = bugs
os.makedirs(opj(export, i), exist_ok=True)
devs = get_devs(i)
for j in glob.glob(opj(basedir, "projects", i, "[0-9]*")) :
@@ -68,7 +69,7 @@ def create_project_list() :
b.id = os.path.basename(j)
r = glob.glob(opj(j, "[0-9]*"))
r.sort()
- b.replies = len(r)
+ b.replies = len(r)-1
f = open(r[0], "rb")
m = BytesParser(policy=policy.default).parse(f)
b.subject = m["Subject"]
@@ -76,8 +77,8 @@ def create_project_list() :
b.subject = "No subject"
bugs.append(b)
replies = []
- for k in r :
- f = open(k, "rb")
+ for l in r :
+ f = open(l, "rb")
m = BytesParser(policy=policy.default).parse(f)
m["Avatar"] = generate_avatar(m["From"])
replies.append(m)
@@ -98,6 +99,9 @@ def create_project_list() :
f = open(opj(export, i, "index.html"), "w")
f.write(buglist.render(DOMAIN=DOMAIN, bugs=bugs, prname=i))
f.close()
+ k.count = len(k.bugs)
+ k.opencount = len([ i for i in k.bugs if not i.closed ])
+
f = open(opj(export, "index.html"), "w")
f.write(template.render(DOMAIN=DOMAIN, projects=projects))
## Create the project list
diff --git a/templates/main_page.html b/templates/main_page.html
index e32cfd4..dabb1ee 100644
--- a/templates/main_page.html
+++ b/templates/main_page.html
@@ -11,6 +11,7 @@
<table>
<thead>
<td>Name
+ <td>Open bugs
<td>Number of bugs
</thead>
{% for i in projects %}
@@ -18,7 +19,9 @@
<td>
<a href="{{ i.name }}"> {{ i.name }}</a>
<td>
- {{ i.count }}
+ {{ i.opencount }}
+ <td>
+ {{ i.count }}
</tr>
{% endfor %}
</table>