App catalog sections stay in oldest-first storage order when reviews aren't loaded
Symptom
GET /v2/apps defaults to include_reviews=False. In that mode get_approved_available_apps fills installs on every app but leaves rating_avg, rating_count and score at zero, and sort_apps_by_installs (backend/utils/apps.py) sorts only by score. Every app then ties at 0.0, so each catalog section comes back in Firestore document-id order (oldest first) instead of by install count. The same happens to every unreviewed app even when reviews are loaded.
Evidence
On origin/main 31a07230bb, backend/routers/apps.py get_apps_v2 defaults include_reviews to False and every section except popular sorts through sort_apps_by_installs. compute_app_score returns 0.0 whenever rating_avg or rating_count is 0, and the sort key was a.score or 0 with no install tie-break.
Expected
Apps with an equal score rank by install count, descending, so the default catalog (reviews not loaded) orders sections by popularity.
I have resolved this issue in PR #23318 (https://github.com/BasedHardware/omi/pull/23318).
Summary of Fix:
- Added
a.installs or 0as the tie-breaker tosort_apps_by_installs(key=lambda a: (a.score or 0.0, a.installs or 0)). - When reviews are unloaded (
include_reviews=False, score=0.0) or when apps have equal review scores, catalog sections now rank apps by install count descending instead of keeping them in oldest-first document order. - Added comprehensive unit tests in
test_app_catalog_installs_tiebreak.py(100% passing).
Payout Wallet: 0xC345C07229307d4f1c7935aD2cAe48e390215808 (USDC)