Skip to content
Snippets Groups Projects
Commit 33b66eea authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Add three new labels for hardware injections

parent 7f04b2d7
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,12 @@ Here is a table showing the currently available labels and their meanings.
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------+
| H1OPS | H1 operator signoff requested. |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------+
| HWINJNO | There were problems with the hardware injection. |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------+
| HWINJOK | A hardware injection was successfully performed. |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------+
| HWINJREQ | A hardware injection is scheduled. |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------+
| INJ | Injection occured near this time. |
+-----------------+----------------------------------------------------------------------------------------------------------------------------------------+
| L1NO | L1 operator says event is not okay. |
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-16 20:07:23
from __future__ import unicode_literals
from django.db import migrations
# List of label names, default colors, and descriptions
LABELS = [
{
'name': 'HWINJREQ',
'defaultColor': 'black',
'description': 'A hardware injection is scheduled.',
},
{
'name': 'HWINJOK',
'defaultColor': 'green',
'description': 'A hardware injection was successfully performed.',
},
{
'name': 'HWINJNO',
'defaultColor': 'red',
'description': 'There were problems with the hardware injection.',
},
]
def add_labels(apps, schema_editor):
Label = apps.get_model('events', 'Label')
# Create labels
for label_dict in LABELS:
l, created = Label.objects.get_or_create(name=label_dict['name'])
l.defaultColor = label_dict['defaultColor']
l.description = label_dict['description']
l.save()
def remove_labels(apps, schema_editor):
Label = apps.get_model('events', 'Label')
# Delete labels
for label_dict in LABELS:
try:
l = Label.objects.get(name=label_dict['name'])
except Label.DoesNotExist:
print('Label {0} not found to be deleted, skipping.' \
.format(label_dict['name']))
break
l.delete()
class Migration(migrations.Migration):
dependencies = [
('events', '0030_siminspiral_source_and_destination_channels_null'),
]
operations = [
migrations.RunPython(add_labels, remove_labels),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment