Commits

Nikolaj Sjujskij committed d323b28

Highlight delayed tickets and display days of delay

  • Participants
  • Parent commits c0b11c4

Comments (0)

Files changed (5)

         #TODO: prettify 404, add info
         abort(404)
     if today.month == basedate.month and today.year == basedate.year:
-        today = today.day
+        today_day = today.day
     else:
-        today = None
+        today_day = None
     del replace_dict
     monthstr = basedate.strftime(DATEFORMAT.replace("%d", "%%"))
 
 
     # a wee bit of simple dictification for opened tickets
     for user, tickets in opened.items():
+        for ticket in tickets:
+            ##TODO: do it within utils.dictify (pass function in add_data)
+            if not ticket['first_due_date']:
+                continue
+            first_due_date = time.strptime(ticket['first_due_date'], DATEFORMAT)
+            first_due_date = datetime.date(first_due_date.tm_year,
+                                           first_due_date.tm_mon,
+                                           first_due_date.tm_mday)
+            delay = today - first_due_date
+            if delay.days > 0:
+                ticket['delayed_by'] = str(delay.days)
+            else:
+                ticket['delayed_by'] = ''
         opened[user] = dictify(tickets, 'trac')
 
     # ...and for closed ones
                'month_name': calendar.month_name[month],
                'month': month,
                'year': cal_year,
-               'today': today,
+               'today': today_day,
                'opened': opened,
                'closed': closed,
                }

File static/base.css

     font-size: 80%;
 }
 
+.delayed .delay:before {
+    content: '['
+}
+
+.delayed .delay:after {
+    content: ']'
+}
+

File static/dark.css

     color: #ccc;
 }
 
+.delayed {
+    background-color: #674747;
+}

File static/light.css

     color: #cccccc;
 }
 
+.delayed {
+    background-color: #fccece;
+}
+

File templates/index.html

             <span class="project_name">{{ trac }}</span>
             <ul>
             {% for ticket in tickets %}
-                <li>
+            <li{% if ticket.delayed_by %} class="delayed"{% endif %}>
                 <a href="{{ ticket.base_url }}/ticket/{{ ticket.id }}"
                    title="{{ ticket.title }}">
                         <span class="num">#{{ ticket.id }}</span>:
                         {{ ticket.summary }}</a>
+                    <span class="delay">{{ ticket.delayed_by }}</span>
                 </li>
             {% endfor %}
             </ul>