Perf-o-matic: dashboard images are not generated properly from incrementally updated...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jul 2012 09:00:33 +0000 (09:00 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jul 2012 09:00:33 +0000 (09:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=92717

Reviewed by Hajime Morita.

Sort the values by timestamp. Unfortunately, there isn't a good way of testing this fix.

* Websites/webkit-perf.appspot.com/models.py:
(Runs.chart_params):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@124184 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Websites/webkit-perf.appspot.com/models.py

index 42c31e3..7b49164 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-07-31  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Perf-o-matic: dashboard images are not generated properly from incrementally updated JSON
+        https://bugs.webkit.org/show_bug.cgi?id=92717
+
+        Reviewed by Hajime Morita.
+
+        Sort the values by timestamp. Unfortunately, there isn't a good way of testing this fix.
+
+        * Websites/webkit-perf.appspot.com/models.py:
+        (Runs.chart_params):
+
 2012-07-31  Danilo Cesar Lemes de Paula  <danilo.cesar@collabora.co.uk>
 
         add Farstream flags/deps to WebKit, for WebRTC
index 148da6e..45ed797 100644 (file)
@@ -455,11 +455,12 @@ class Runs(db.Model):
     def chart_params(self, display_days):
         chart_data_x = []
         chart_data_y = []
-        runs = json.loads('[' + self.json_runs + ']')
+        timestamp_from_entry = lambda entry: Runs._timestamp_and_value_from_json_entry(entry)[0]
+        runs = sorted(json.loads('[' + self.json_runs + ']'), lambda a, b: int(timestamp_from_entry(a) - timestamp_from_entry(b)))
         if not runs:
             return None
 
-        end_timestamp = Runs._timestamp_and_value_from_json_entry(runs[-1])[0]
+        end_timestamp = timestamp_from_entry(runs[-1])
         start_timestamp = end_timestamp - display_days * 24 * 3600
         for entry in runs:
             timestamp, value = Runs._timestamp_and_value_from_json_entry(entry)