[OE-core] [PATCH 1/9] error-report: add 'Submitted on' column

Roxana Ciobanu roxana.ciobanu at intel.com
Fri Aug 22 08:49:37 UTC 2014


Show the submission date and time for an error in the
search results page

[YOCTO #6538]

Signed-off-by: Roxana Ciobanu <roxana.ciobanu at intel.com>
---
 Post/createStatistics.py      | 4 ++++
 Post/getInfo.py               | 3 +++
 Post/parser.py                | 3 ++-
 templates/search-details.html | 2 ++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Post/createStatistics.py b/Post/createStatistics.py
index e4d9e3f..1df3e51 100644
--- a/Post/createStatistics.py
+++ b/Post/createStatistics.py
@@ -39,6 +39,10 @@ class Statistics:
     def chart_statistics(self, string):
         startdate = datetime.now()
         enddate = startdate - timedelta(days=30)
+        if string == "DATE":
+            date = Build.objects.filter(DATE__range=[enddate, startdate]).values('DATE').annotate(dcount=Count('DATE'))
+            items = list(date)
+            return self.create_statistic(items, "DATE")
         if string == "MACHINE":
             machines = Build.objects.filter(DATE__range=[enddate, startdate]).values('MACHINE').annotate(dcount=Count('MACHINE'))
             items = list(machines)
diff --git a/Post/getInfo.py b/Post/getInfo.py
index 3e9936d..5f0c3eb 100644
--- a/Post/getInfo.py
+++ b/Post/getInfo.py
@@ -68,6 +68,9 @@ class Info:
                 except:
                     pass
 
+            if category == "DATE":
+                build = Build.objects.filter(DATE__icontains = string)
+                results.append(self.getBuildFailures(build))
             if category == "MACHINE":
                 build = Build.objects.filter(MACHINE__icontains = string)
                 results.append(self.getBuildFailures(build))
diff --git a/Post/parser.py b/Post/parser.py
index 35325f1..fae9194 100644
--- a/Post/parser.py
+++ b/Post/parser.py
@@ -10,6 +10,7 @@
 import sys, os, json, re
 from Post.models import Build, BuildFailure
 from django.conf import settings
+from django.utils import timezone
 from datetime import datetime
 
 class Parser:
@@ -30,7 +31,7 @@ class Parser:
         NAME = str(jsondata['username'])
         EMAIL = str(jsondata['email'])
         g = re.match(r'(.*): (.*)', str(BRANCH_COMMIT))
-        b=Build(DATE = datetime.now(), MACHINE = MACHINE_NAME, BRANCH = g.group(1), COMMIT = str(g.group(2)), TARGET = COMPONENT, DISTRO = DISTRO, NATIVELSBSTRING = NATIVELSBSTRING, BUILD_SYS = BUILD_SYS, TARGET_SYS = TARGET_SYS, NAME = NAME, EMAIL = EMAIL)
+        b=Build(DATE = timezone.now(), MACHINE = MACHINE_NAME, BRANCH = g.group(1), COMMIT = str(g.group(2)), TARGET = COMPONENT, DISTRO = DISTRO, NATIVELSBSTRING = NATIVELSBSTRING, BUILD_SYS = BUILD_SYS, TARGET_SYS = TARGET_SYS, NAME = NAME, EMAIL = EMAIL)
         b.save()
         failures = jsondata['failures']
         for fail in failures:
diff --git a/templates/search-details.html b/templates/search-details.html
index cf57507..3941a1f 100644
--- a/templates/search-details.html
+++ b/templates/search-details.html
@@ -16,6 +16,7 @@
 					<table class="table table-bordered table-hover">
 						<thead>
 							<tr>
+								<th>Submitted on</th>
 								<th>Recipe</th>
 								<th>Recipe version</th>
 								<th>Task</th>
@@ -31,6 +32,7 @@
 						<tbody>
 							{%for detail in details %}
 								<tr>
+									<td><a href="{% url id detail.id details.number items d %}">{{ detail.BUILD.DATE|date:"d/m/y H:i"}}</a></td>
 									<td><a href="{% url id detail.id details.number items d %}">{{ detail.RECIPE }}</a></td>
 									<td><a href="{% url id detail.id details.number items d %}">{{ detail.RECIPE_VERSION }}</a></td>
 									<td><a href="{% url id detail.id details.number items d %}">{{ detail.TASK }}</a></td>
-- 
1.9.1




More information about the Openembedded-core mailing list