Use slot afterid
Displace findAllPendingApplication before findBestApplicationById
Rewrite findAllPendingApplication sql request to avoid unattributed sessions without usable application at some point
Rewrite findBestApplicationById with optimal conditions