Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] When setting the Telemetry data in PUT /set_telemetry an invalid flight datetime query filter is used #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cyapa
Copy link
Contributor

@cyapa cyapa commented Apr 3, 2024

Bug: When setting the telemetry, the query to retrieve active flights was set to 2 minutes before now - 5 hours after now This will prevent the storing of telemetry because there can be active flights that are not started only 2 minutes before

Fix: Changed the flight datetime query so that it fetches all flight plans that falls between now time
example: flight_starttime -> now <-flight_endtime

start_datetime__gte=two_minutes_before_now,
end_datetime__lte=five_hours_from_now,
start_datetime__lte=now,
end_datetime__gte=now,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @cyapa , I understand the bug but your query will catch any flight greater than now and less than now, should there not be additional filter e.g .one's that are currently declared or active?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @hrishiballal , you have that filter in place here: https://github.com/openutm/flight-blender/blob/master/flight_feed_operations/views.py#L326 to capture only flights in certain states. So I think we are okay to proceed with this fix.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK no problems, the one bit remains, I can then merge this PR>

@@ -454,8 +452,7 @@ def set_telemetry(request):

unsigned_telemetry_observations.append(asdict(single_observation_set, dict_factory=NestedDict))
operation_id = f_details.id
now = arrow.now().isoformat()
relevant_operation_ids_qs = my_blender_database_reader.get_current_flight_declaration_ids(now=now)
relevant_operation_ids_qs = my_blender_database_reader.get_current_flight_declaration_ids()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should have the ability to filter out based on the current time , so lets keep a variable in the method to enable filtering based on the current time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But isn't now always be a static value? If we make it an argument then now can be assigned with any timestamp value in the past or future not the value for now. If we allow this then probably we change the name now to something else like, timestamp etc.?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have now updated the field to have the timestamp, can you please recheck your PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants