Skip to content
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

Game log processing can't handle multiple plays of the same card #404

Closed
shaldengeki opened this issue Aug 20, 2024 · 0 comments · Fixed by #407
Closed

Game log processing can't handle multiple plays of the same card #404

shaldengeki opened this issue Aug 20, 2024 · 0 comments · Fixed by #407
Assignees
Labels
ark_nova_stats bug Something isn't working python Pull requests that update Python code

Comments

@shaldengeki
Copy link
Owner

Right now, if a single card is played multiple times in a game (i.e. an animal is played, released, scavenged, then re-played) we currently don't handle this well, and don't record the second card play in the database.

See this query:
https://fly-metrics.net/d/fly-logs/fly-logs?orgId=784986&var-app=ark-nova-stats-api&from=now%2Fy&to=now%2Fy&var-query=SAWarning&var-instance=All

	2024-08-19 23:54:44.872	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (2201, 130, 94796767), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-19 23:53:12.380	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (2188, 12, 94796767), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-19 23:53:12.380	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (2188, 9, 94796767), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-19 23:46:43.542	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (2160, 27, 94319519), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-19 23:46:39.671	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (2155, 7, 94319519), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-18 22:53:04.603	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (2100, 195, 84320942), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-17 21:34:57.329	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (1870, 15, 95927087), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-16 13:05:18.183	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (1658, 166, 87105665), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-13 23:57:18.358	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (1528, 148, 94319519), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-13 23:21:04.338	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (1491, 16, 96245793), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-13 23:11:17.460	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/api/gql/types/game_log.py:103: SAWarning: Identity map already had an identity for (<class 'ark_nova_stats.models.CardPlay'>, (1417, 161, 95451879), None), replacing it with newly flushed object.   Are there load operations occurring inside of an event handler within the flush?
	
	
2024-08-13 01:21:36.959	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/models.py:154: SAWarning: SELECT statement has a cartesian product between FROM element(s) "game_log_cards" and FROM element "cards".  Apply join condition(s) between each element to resolve.
	
	
2024-08-13 01:20:03.143	
/ark_nova_stats/api/api_image_binary.runfiles/_main/ark_nova_stats/models.py:154: SAWarning: SELECT statement has a cartesian product between FROM element(s) "game_log_cards" and FROM element "cards".  Apply join condition(s) between each element to resolve.

This is because, i think, we've configured the SQLAlchemy database models for CardPlay, GameLog, and Card to join uniquely on that tuple of ids. When we process a game like this, we emit the two plays with different moves, but SQLAlchemy sees the second emission and thinks "oh this is just the first one", and doesn't record it.

Check if this is the case. If so, then we should probably reconfigure the relations to include the move ID.

@shaldengeki shaldengeki added bug Something isn't working python Pull requests that update Python code ark_nova_stats labels Aug 20, 2024
@shaldengeki shaldengeki self-assigned this Aug 21, 2024
@shaldengeki shaldengeki linked a pull request Aug 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ark_nova_stats bug Something isn't working python Pull requests that update Python code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant