Skip to content

Commit

Permalink
simplified getting observation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Nation committed Jun 6, 2019
1 parent ea1cb09 commit 37387df
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions observation_portal/requestgroups/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from django.apps import apps
from django.db import models
from django.contrib.auth.models import User
from django.contrib.postgres.fields import JSONField
Expand Down Expand Up @@ -195,8 +194,7 @@ def as_dict(self, for_observation=False):
ret_dict['configurations'] = [c.as_dict() for c in self.configurations.all()]
if not for_observation:
if self.request_group.observation_type == RequestGroup.DIRECT:
Observation = apps.get_model('observations', 'Observation')
observation = Observation.objects.get(request=self)
observation = self.observation_set.first()
ret_dict['location'] = {'site': observation.site, 'enclosure': observation.enclosure,
'telescope': observation.telescope}
ret_dict['windows'] = [{'start': observation.start, 'end': observation.end}]
Expand Down

0 comments on commit 37387df

Please sign in to comment.