ponder-lab / Imperative-DL-Study-Web-App

0 stars 0 forks source link

Filter categorizations by round #102

Closed ZhongweiL closed 3 years ago

ZhongweiL commented 3 years ago

Allow categories to be filtered by url query parameter, setting up a form that sends query parameters to the categories page. Intends to resolve issue https://github.com/ponder-lab/Imperative-DL-Study-Web-App/issues/93

khatchad commented 3 years ago

@mZneit, if you have time, can you review this PR? How can we deploy it to see it in action? Thanks

mZneit commented 3 years ago

I tested this locally. It works but it's only limited to 4 rounds. We already have more than that so it needs to be generalized to an arbitrary number of rounds.

ZhongweiL commented 3 years ago

How about I change it to display the maximum number of rounds in the list of commits?

khatchad commented 3 years ago

Thanks, Manal.

mZneit commented 3 years ago

@ZhongweiL yes, you need the code to find the maximum number of rounds in the commits table and then filter the categorizations based on the requested round number.

mZneit commented 3 years ago

Thanks. This works well. It filters the categorizations by round number. OPTIONAL: @ZhongweiL can you think of a method that is more time efficient? The filter takes a bit long to display the tables. Maybe a more efficient way to find the maximum number of rounds?

ZhongweiL commented 3 years ago

Since the rounds are sorted in the commits table, maybe we can search starting from the end of the table and get the first value that is numeric. But I'm not sure if Django allows us to do that. Do you have any suggestions?

mZneit commented 3 years ago

I think this is a good idea. But if the rounds column is not sorted we'll miss the maximum. I think we can get the values of rounds in all commits and remove duplicates. This will result in a small set where the max can be found efficiently.

ZhongweiL commented 3 years ago

Isn't that the same speed as the current implementation? Getting values of rounds from all commits also takes linear time.

mZneit commented 3 years ago

I was thinking of changing the data structure. Storing the rounds values_list in a set will remove all duplicates. That's fine I will merge the current implementation.

khatchad commented 3 years ago

Are there any extraneous DB queries?

mZneit commented 3 years ago

Actually after making few GET request to test the rounds I got the error: exceeded the 'max_questions' resource (current value: 3600)").

mZneit commented 3 years ago

I modified the code. I think it was a complicated query that was causing the slow down but the code was correct.