Currently, the lessons page is slow because it builds out one view for all lessons which aggregates a completely different view which is quite expensive. The problem is that we do this for literally all the lessons we plan on paginating.
What we SHOULD do is apply scopes on the lessons we actually plan on displaying querying lessons directly, and then use those to build out the LessonTableRow with the calculations that we need. This would involve probably some extra methods either in the controller or LessonTableRow, but should reduce the querying time quite a bit.
This ticket will ideally also resolve the 504 error that users in Africa have been reporting with slow internet connections.
Currently, the lessons page is slow because it builds out one view for all lessons which aggregates a completely different view which is quite expensive. The problem is that we do this for literally all the lessons we plan on paginating.
What we SHOULD do is apply scopes on the lessons we actually plan on displaying querying lessons directly, and then use those to build out the
LessonTableRowwith the calculations that we need. This would involve probably some extra methods either in the controller orLessonTableRow, but should reduce the querying time quite a bit.This ticket will ideally also resolve the
504error that users in Africa have been reporting with slow internet connections.