Browse Source

Update EventType enum, update class of details

pull/24/head
Tung Lam Nguyen Le 3 years ago
committed by Jérôme Deuchnord
parent
commit
a182e9e7c8
3 changed files with 6 additions and 4 deletions
  1. +1
    -0
      kosmorrolib/enum.py
  2. +4
    -3
      kosmorrolib/events.py
  3. +1
    -1
      kosmorrolib/model.py

+ 1
- 0
kosmorrolib/enum.py View File

@@ -30,6 +30,7 @@ class EventType(Enum):
MAXIMAL_ELONGATION = 4
MOON_PERIGEE = 5
MOON_APOGEE = 6
SEASON_CHANGE = 7


class ObjectType(Enum):


+ 4
- 3
kosmorrolib/events.py View File

@@ -185,7 +185,7 @@ def _search_maximal_elongations(
EventType.MAXIMAL_ELONGATION,
[aster],
translate_to_timezone(time.utc_datetime(), timezone),
details="{:.3n}°".format(elongation),
details={ 'deg': elongation},
)
)

@@ -272,9 +272,10 @@ def _search_earth_season_change(start_time: Time, end_time: Time, timezone: int)
return []
else:
events.append(Event(
SeasonType(y[0]),
EventType.SEASON_CHANGE,
[],
translate_to_timezone(t.utc_datetime()[0], timezone)))
translate_to_timezone(t.utc_datetime()[0], timezone)),
details={'season':SeasonType(y[0])} )
return events




+ 1
- 1
kosmorrolib/model.py View File

@@ -154,7 +154,7 @@ class Event(Serializable):
objects: [Object],
start_time: datetime,
end_time: Union[datetime, None] = None,
details: str = None,
details: dict=None,
):
self.event_type = event_type
self.objects = objects


Loading…
Cancel
Save