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

Fixing duplicate row error -- PGTT and Player Season #81

Merged
merged 2 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion stats/general_requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def generate_rows(self, params):

def populate(self):
"""
Bulk insert.
Bulk insert. Remove row cache from object once finished.
"""
insert_many(self.settings, self.table, self.rows)
self.rows = []
3 changes: 2 additions & 1 deletion stats/player_general_traditional_total.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ def generate_rows(self, season_id):

column_mapping = get_rowset_mapping(result_sets, column_names)

season_id_int = season_id_to_int(season_id)
for row in rowset:
new_row = {column_name: row[row_index] for column_name, row_index in column_mapping.items()}
new_row['season_id'] = season_id_to_int(season_id)
new_row['season_id'] = season_id_int
self.rows.append(new_row)

super().populate()
Expand Down
3 changes: 2 additions & 1 deletion stats/player_season.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ def populate_season(self, season_id):

column_mapping = get_rowset_mapping(result_sets, column_names)

season_id_int = season_id_to_int(season_id)
for row in rowset:
new_row = {column_name: row[row_index] for column_name, row_index in column_mapping.items()}
new_row['season_id'] = season_id_to_int(season_id)
new_row['season_id'] = season_id_int
self.rows.append(new_row)

super().populate()
Expand Down