Make results colorful 51/108751/3
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Fri, 16 Dec 2016 10:28:25 +0000 (11:28 +0100)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Wed, 1 Feb 2017 16:36:51 +0000 (17:36 +0100)
Meaning of the colors in html results:
 * yellow - not modified in last 2h, but less than 6h
            and not in the final state
 * red - not modified for at least 6h
         and not in the final state

Final state is one of OK, Unclear or Fail.

Change-Id: Ie7a1bf4a391ff7db543a2b1d078e0dffb00057f0
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
tsp/scripts/publish.py

index 38e51b5..b9237d1 100755 (executable)
@@ -21,6 +21,7 @@
 import argparse
 import sqlite3
 import jinja2
+import datetime
 
 __version__ = "0.0.3"
 __license__ = "APACHE-2.0"
@@ -82,6 +83,15 @@ def print_view(dbpath, tizen3):
         if not sr == prev_sr:
             prev_sr = sr
             col = next_color(col)
+        m_date = datetime.datetime.strptime(row[1], "%Y-%m-%d %H:%M:%S")
+        timedelta = datetime.datetime.utcnow() - m_date
+        if ( row[4] == 'In test queue' or row[4] == 'Testing' or row[4] == 'Downloading' ) and timedelta < datetime.timedelta(days=2):
+            if timedelta > datetime.timedelta(hours=6):
+                print_row(row, "red")
+                continue
+            elif timedelta > datetime.timedelta(hours=2):
+                print_row(row, "yellow")
+                continue
         print_row(row, col)
     conn.close()