Parcourir la source

Timestamp results when we receive them

Baptiste Jonglez il y a 10 ans
Parent
commit
25ca2bcc02
2 fichiers modifiés avec 5 ajouts et 2 suppressions
  1. 3 0
      peerfinder.py
  2. 2 2
      templates/results.html

+ 3 - 0
peerfinder.py

@@ -96,6 +96,8 @@ class Result(db.Model):
                                   backref=db.backref('results', lazy='dynamic'))
                                   backref=db.backref('results', lazy='dynamic'))
     # In milliseconds
     # In milliseconds
     rtt = db.Column(db.Float)
     rtt = db.Column(db.Float)
+    # Date at which the result was reported back to us
+    date = db.Column(db.DateTime)
 
 
     def __init__(self, target_id, participant_uuid, rtt):
     def __init__(self, target_id, participant_uuid, rtt):
         target = Target.query.get_or_404(int(target_id))
         target = Target.query.get_or_404(int(target_id))
@@ -104,6 +106,7 @@ class Result(db.Model):
         self.target = target
         self.target = target
         self.participant = participant
         self.participant = participant
         self.rtt = float(rtt)
         self.rtt = float(rtt)
+        self.date = datetime.now()
 
 
 
 
 def init_db():
 def init_db():

+ 2 - 2
templates/results.html

@@ -1,4 +1,4 @@
-Latencies to {{ target }}
+Latencies to {{ target }} (job submitted at {{ target.submitted }})
 
 
 <table>
 <table>
   <tr>
   <tr>
@@ -12,7 +12,7 @@ Latencies to {{ target }}
     <td>{{ r.participant.name }}</td>
     <td>{{ r.participant.name }}</td>
     <td>{{ r.participant.contact }}</td>
     <td>{{ r.participant.contact }}</td>
     <td>{{ r.rtt }} ms</td>
     <td>{{ r.rtt }} ms</td>
-    <td></td>
+    <td>{{ r.date }}</td>
   </tr>
   </tr>
   {% endfor %}
   {% endfor %}
 </table>
 </table>