From 4c05b76a66b57cfd055e58e5613918767b9e47f1 Mon Sep 17 00:00:00 2001 From: Branson Stephens <branson.stephens@ligo.org> Date: Tue, 12 May 2015 08:34:48 -0500 Subject: [PATCH] Fixed Latest results page so that fractional seconds are available for the Event time. --- gracedb/templatetags/timeutil.py | 15 +++++++++++---- templates/gracedb/latest.html | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gracedb/templatetags/timeutil.py b/gracedb/templatetags/timeutil.py index ee7ed7e77..0e65e56ff 100644 --- a/gracedb/templatetags/timeutil.py +++ b/gracedb/templatetags/timeutil.py @@ -34,10 +34,7 @@ register = template.Library() # will convert from that time system, to ... # <time value="POSIX TIME VALUE" [label="LABEL"]>FORMATTED TIME</time> -@register.filter -def multiTime(t, label, autoescape=None): - format = FORMAT - +def get_multitime_value(t, label, autoescape, format): if autoescape: esc = conditional_escape else: @@ -87,8 +84,18 @@ def multiTime(t, label, autoescape=None): (utc_time, gps_time, llo_time, lho_time, virgo_time, js_parsable_time, label_attr, display_time) return mark_safe(rv) + +@register.filter +def multiTime(t, label, autoescape=None): + format = FORMAT + return get_multitime_value(t, label, autoescape, format) multiTime.needs_autoescape = True +@register.filter +def multiTimeMicroSeconds(t, label, autoescape=None): + format = 'Y-m-d H:i:s.u T' + return get_multitime_value(t, label, autoescape, format) +multiTimeMicroSeconds.needs_autoescape = True @register.filter def timeselect(label, default, autoescape=None): diff --git a/templates/gracedb/latest.html b/templates/gracedb/latest.html index 80d5c44a4..6a98b11b2 100644 --- a/templates/gracedb/latest.html +++ b/templates/gracedb/latest.html @@ -136,7 +136,7 @@ <td>{{ object.instruments }}</td> <td>{% if object.gpstime%} <!-- <span title="{{ object.gpstime|gpsdate }}">{{ object.gpstime }}</span> --> - {{ object.gpstime|multiTime:"gps" }} + {{ object.gpstime|multiTimeMicroSeconds:"gps" }} {% endif %}</td> <td>{{ object.far|scientific }}</td> <td style="text-align:center">{{ object.reportingLatency }}</td> -- GitLab