Skip to content

Conversation

@dfabulich
Copy link
Collaborator

We were filtering out special reviews, embargoed reviews, and sandboxed reviews with the where clause, but this meant that games that had reviews but only special reviews were excluded from the view completely.

Now, we've moved the filters into the criteria for the left outer joins. If there happen to be no rows that match those criteria, that's fine, it's an outer join, so we'll still have at least one row per game in the grouped query results.

For example, zz69axowzyl0htmh "Murder Mansion" had just one special review. Previously, the grouped query returned 0 rows for this game, now it returns one row with count: 0 rating: NULL.

Fixes #1255

@dfabulich dfabulich requested a review from salty-horse January 18, 2025 03:59
)
and `ifdb`.`reviews`.`special` is null
)
left outer join `ifdb`.`users` on(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add space between on(

)
and `ifdb`.`reviews`.`special` is null
)
left outer join `ifdb`.`users` on(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add space between on(

We were filtering out special reviews, embargoed reviews, and sandboxed reviews with the `where` clause, but this meant that games that had reviews but _only_ special reviews were excluded from the view completely.

Now, we've moved the filters into the criteria for the `left outer join`s. If there happen to be no rows that match those criteria, that's fine, it's an outer join, so we'll still have at least one row per game in the `grouped` query results.

For example, zz69axowzyl0htmh "Murder Mansion" had just one special review. Previously, the `grouped` query returned 0 rows for this game, now it returns one row with `count: 0` `rating: NULL`.

Fixes #1255
@dfabulich dfabulich force-pushed the add-missing-games-to-materialized-view branch from bea09f4 to 9a7f98a Compare January 18, 2025 17:58
@dfabulich dfabulich merged commit 2332f75 into main Jan 18, 2025
dfabulich added a commit that referenced this pull request Jan 19, 2025
Prior to #1256, we were excluding special reviews, embargoed reviews, and sandboxed reviews with a `where` clause, but this meant that some games were missing from `gameRatingsSandbox0`, when all of a game's reviews were special reviews. In #1256, I removed the `where` clause and turned them into criteria on the `join` clauses.

This worked fine for special reviews and embargoed reviews, but it didn't work for sandboxed reviews. We did a left join to the `users` table, excluding sandboxed users there, but we didn't use the results of that join. We never used `users.userid` for anything, and we never excluded any sandboxed reviews in the criteria for the `reviews` table.

I've removed the join to `users` and replaced it with another criterion on the join to the `reviews` table, excluding reviews where the `userid` is sandboxed.

I've confirmed that this still excludes special and embargoed reviews, and now it excludes sandboxed reviews, too. Also, I've confirmed that the number of rows matches the number of rows in the games table, so every game has a matching row in `gameRatingsSandbox0`.

Fixes #1263
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some games aren't being counted when browsing all games

3 participants