-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix data export #344
base: master
Are you sure you want to change the base?
Fix data export #344
Conversation
Looks alright to me. |
So before this line:
would fetch zero rows when the $3 is nil. And we would get the error as shown in #334 Now, it should not error if you actually have matches. If you don't have any matches at all it would error but that would only occur if you didn't run the |
This no longer passes tests so setting to draft. Also it might not be needed because there may other ways to access the data if we set up data dumps. |
defp get_match_count_query(start_date, end_date, rating_type_id) do | ||
query = """ | ||
SELECT COUNT(id) | ||
FROM teiserver_battle_matches | ||
WHERE | ||
started >= $1 | ||
AND finished < $2 | ||
AND processed = true | ||
AND winning_team IS NOT NULL | ||
AND finished IS NOT NULL | ||
AND started IS NOT NULL | ||
""" | ||
|
||
if(rating_type_id == nil) do | ||
Ecto.Adapters.SQL.query(Repo, query, [start_date, end_date]) | ||
else | ||
query = query <> " AND rating_type_id = $3" | ||
|
||
Ecto.Adapters.SQL.query(Repo, query, [start_date, end_date, rating_type_id]) | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this change is needed now. The rest has been fixed with team split fixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only query changes are needed, the rest has been fixed with team split fixes.
Work Done
Fixes #334
Also allows filtering by Small Team and Large Team when exporting data
Test Steps