BuddhaNexus / buddhanexus

Backend for the Buddhanexus project
8 stars 2 forks source link

Sorting menu data #330

Closed ayya-vimala closed 2 weeks ago

ayya-vimala commented 2 weeks ago

The menu data is not in the right order. I've added a SORT to the query to make sure that doesn't happen but it will add extra time to the calculations. There might be another way?

sebastian-nehrdich commented 2 weeks ago

I am not entirely sure if SORT on filenr is the right way here since we are constructing the data structure in a separate python function that uses dictionaries. I added a natsort to the helper funtion which might serve the same purpose: https://github.com/BuddhaNexus/buddhanexus/blob/af689e02972358bb931b0f07ee226dae31269a57/api/endpoints/helpers/menu_helpers.py#L59 Alternatively we could also transfer the filenr with each segment and sort on that in the helper function.

sebastian-nehrdich commented 2 weeks ago

I checked the code again today and I guess the SORT is totally fine, better than the natsort in the postprocessing function so we can just do this!