-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Slim down site and fix many database query issues #457
Merged
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
2afaa39
Improve ML model handling
Sciguymjm e7e5dfd
Improve ML model handling
Sciguymjm afc04ed
Fix for private 2s
Sciguymjm b59abe4
Add rumble
Sciguymjm 7e26547
Add extra modes
Sciguymjm fc1d887
DB changes
Sciguymjm 7e20d01
Extra modes
Sciguymjm d0bf727
Optimize player profile stats
Sciguymjm b8dd5c2
Fix db debug issues
Sciguymjm bddf808
Optimize profile stats
Sciguymjm c919081
Open up beta tabs
Sciguymjm 445b5b2
Fix profile stats
Sciguymjm f8d3113
Remove favorite car?
Sciguymjm 43f7331
Revert revert
Sciguymjm 9ee0b15
Support external DB
Sciguymjm 7ebba01
Item stats error logging
Sciguymjm 5dd7686
Cache replay count
Sciguymjm bdcfc35
Cache recent replays
Sciguymjm b8ae8bc
Recycle connections
Sciguymjm cac59fe
Session fixers
Sciguymjm fa9345e
Error logging
Sciguymjm 300e367
Remove playstyle/stats temporarily
Sciguymjm ac3b2a8
Remove leaderboards
Sciguymjm 101ec89
Remove leaderboard link
Sciguymjm 910d604
Slim down
Sciguymjm 348215d
Bring back background
Sciguymjm 703bcf6
Task changes
Sciguymjm c1ce03b
Limit training packs again
Sciguymjm d3e27a4
Add groups to replay page
Sciguymjm ff1cafc
Fix bot handling
Sciguymjm 0226787
Switch ordering of playlists
Sciguymjm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ | |
from backend.blueprints.spa_api.service_layers.ml.ml import model_holder | ||
except ModuleNotFoundError: | ||
model_holder = None | ||
print("Not using ML because required packages are not installed. Run `pip install -r requirements-ml.txt` to use ML.") | ||
print( | ||
"Not using ML because required packages are not installed. Run `pip install -r requirements-ml.txt` to use ML.") | ||
|
||
|
||
class PredictedRank: | ||
|
@@ -33,13 +34,38 @@ def create_from_id(id_: str, session=None) -> List['PredictedRank']: | |
accepted_playlists = [ | ||
13, # standard | ||
3, # unranked standard | ||
6, # custom | ||
6, # custom, | ||
11, # doubles | ||
2, # unranked doubles | ||
10, # ranked duels | ||
1, # unranked duels | ||
27, # hoops | ||
28, # rumble | ||
29, # dropshot | ||
30, # snow day | ||
] | ||
if game.playlist not in accepted_playlists: | ||
raise UnsupportedPlaylist | ||
|
||
playergames = session.query(PlayerGame).filter(PlayerGame.game == id_).all() | ||
|
||
adjusted_playlist_map = { | ||
2: 11, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here as above |
||
11: 11, | ||
3: 13, | ||
6: 13, | ||
13: 13, | ||
10: 10, | ||
1: 10, | ||
27: 27, | ||
28: 28, | ||
29: 29, | ||
30: 30 | ||
} | ||
playlist = adjusted_playlist_map[game.playlist] | ||
if game.playlist == 6 and len(game.players) == 4: | ||
playlist = 11 | ||
elif game.playlist == 6 and len(game.players) == 2: | ||
playlist = 10 | ||
if is_local_dev(): | ||
import random | ||
ranks = [ | ||
|
@@ -48,7 +74,7 @@ def create_from_id(id_: str, session=None) -> List['PredictedRank']: | |
] | ||
else: | ||
ranks = [ | ||
PredictedRank(pg.player, model_holder.predict_rank(pg)) | ||
PredictedRank(pg.player, model_holder.predict_rank(pg, playlist=playlist)) | ||
for pg in playergames | ||
] | ||
return ranks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is it required to be in this exact order?
just thinking that putting them in numbered order might be easier to read