Example #1
0
def saveNewEvent(flight_number, event, data):
    LOG.info("Saving new Event")

    if not isValidEvent(data['event'], event):
        return False

    flight = service.getFlightByNumber(flight_number)

    time_received = int(time.time())

    return service.saveNewEvent(flight, data, time_received)
Example #2
0
def flightExists(flight_number):
    """
    Checks if Flight with requested Flgiht Number exists in Database
    @param flight_number: Flight Number
    @return: boolean
    """
    flight = service.getFlightByNumber(flight_number)
    if flight is Flight:
        return True
    else:
        return False
Example #3
0
def saveNewParameters(flight_number, data):
    flight = service.getFlightByNumber(flight_number)
    # Get modified Flight object from DB

    time_received = int(time.time())
    # Get time of message receive

    service.saveParameterWithValues(flight, data, time_received)
    # Save new parameters

    return True
Example #4
0
def getBalloonBurst(flight_number):
    position = None

    flight = service.getFlightByNumber(flight_number)
    events = service.getEventsByFlight(flight.id)

    for e in events:
        if e.type == "burst":
            service.fillParametersDictionary(e)
            parameter = e.parametersDict["position"]
            position = {
                'type': "burst",
                'point': {
                    'time': parameter.time_received,
                    'lat': parameter.valuesDict["lat"].value,
                    'lng': parameter.valuesDict["lng"].value
                }
            }

    LOG.debug("BalloonBurst: ", position)

    return position