Skip to content

Commit

Permalink
Add a little better attempt to find the right Yarkovsky object when m…
Browse files Browse the repository at this point in the history
…ultiple Body's exist
  • Loading branch information
talister committed May 14, 2021
1 parent 04e7b12 commit f585aa4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ def handle(self, *args, **options):
self.stdout.write("\n".join(target_list))
self.stdout.write("========================")
for obj_id in target_list:
orbelems = model_to_dict(Body.objects.get(name=obj_id))
try:
target = Body.objects.get(name=obj_id)
except Body.MultipleObjectsReturned:
target = Body.objects.get(name=obj_id, active=True)
orbelems = model_to_dict(target)
visible_dates, emp_visible_dates, dark_and_up_time_all, max_alt_all = monitor_long_term_scheduling(options['site_code'], orbelems, datetime.strptime(options['start_date'], '%Y-%m-%d'), options['date_range'], options['dark_and_up_time_limit'])
self.stdout.write("Reading target %s" % obj_id)
self.stdout.write("Visible dates:")
Expand Down

0 comments on commit f585aa4

Please sign in to comment.