Commit 1120e0c3 authored by Tanner Prestegard's avatar Tanner Prestegard
Browse files

Merge branch 'offline' into 'master'

Adding offline boolean parameter to Event model class

See merge request !4
parents eaa8fffd b9585f48
......@@ -57,6 +57,11 @@ class CreateEventForm(forms.Form):
labels = forms.CharField(required=False)
#type = forms.ChoiceField(choices=typeChoices)
# Offline boolean. required=False means that if the user
# doesn't provide a value, we use the default defined in models.py.
# This ensures backwards-compatibility for client versions which
# don't specify this parameter.
offline = forms.BooleanField(required=False)
class EventSearchForm(forms.Form):
groupChoices = [("","")]+[(g.name, g.name) for g in Group.objects.all()]
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gracedb', '0020_fix_lib_perms'),
]
operations = [
migrations.AddField(
model_name='event',
name='offline',
field=models.BooleanField(default=False),
),
]
......@@ -135,6 +135,13 @@ class Event(models.Model):
# searches quite considerably.
perms = models.TextField(null=True)
# Boolean which determines whether the event was submitted by an offline
# analysis (True) or an online/low-latency analysis (False). Because this
# is being implemented during a run (O2), we use a default value of False
# so as to ensure backwards-compatibility; i.e., all events treated as
# "online" by default.
offline = models.BooleanField(default=False)
class Meta:
ordering = ["-id"]
......
......@@ -45,6 +45,7 @@ def _createEventFromForm(request, form):
pipeline = Pipeline.objects.get(name=form.cleaned_data['pipeline'])
search_name = form.cleaned_data['search']
label_str = form.cleaned_data['labels']
offline = form.cleaned_data['offline']
if search_name:
search = Search.objects.get(name=form.cleaned_data['search'])
else:
......@@ -67,6 +68,7 @@ def _createEventFromForm(request, form):
event.group = group
event.pipeline = pipeline
event.search = search
event.offline = offline
# If the event is an injection, look for certain attributes in the POST data.
# These attributes are unfortunately not found in the SimInspiralTable
......
......@@ -134,6 +134,7 @@ def eventToDict(event, columns=None, request=None):
rv['gpstime'] = event.gpstime
rv['instruments'] = event.instruments
rv['nevents'] = event.nevents
rv['offline'] = event.offline
far_is_upper_limit = False
display_far = event.far
......
......@@ -119,6 +119,11 @@
</div>
{% endif %}
{% if object.offline %}
<div style="text-align: center;">
<h2 style="color: red;">OFFLINE EVENT</h2>
</div>
{% endif %}
<!-- Here is a section for the EM advocate signoffs. -->
<!-- XXX So much ugliness here. Is there a way to do this with the JS? -->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment