Spaces:
Build error
Build error
James McCool commited on
Commit ·
0bb6eb5
1
Parent(s): 1420999
Making some updates to the database querying
Browse files- database_queries.py +4 -4
database_queries.py
CHANGED
|
@@ -528,7 +528,7 @@ def init_FD_NFL_lineups(type_var, slate_var, prio_var, prio_mix, nfl_db_translat
|
|
| 528 |
cursor2 = collection.find({'$and': [filter_query, {'salary': {'$gte': salary_min, '$lte': salary_max},
|
| 529 |
'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 530 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
| 531 |
-
}]}).sort('Own', -1).limit(
|
| 532 |
else:
|
| 533 |
cursor1 = collection.find({'salary': {'$gte': salary_min, '$lte': salary_max},
|
| 534 |
'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
|
@@ -1055,7 +1055,7 @@ def init_FD_NBA_lineups(type_var, slate_var, prio_var, prio_mix, nba_db_translat
|
|
| 1055 |
cursor2 = collection.find({'$and': [filter_query, {'salary': {'$gte': salary_min, '$lte': salary_max},
|
| 1056 |
'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 1057 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
| 1058 |
-
}]}).sort('Own', -1).limit(
|
| 1059 |
else:
|
| 1060 |
cursor1 = collection.find({'salary': {'$gte': salary_min, '$lte': salary_max}, 'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 1061 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
|
@@ -1543,7 +1543,7 @@ def init_FD_NHL_lineups(type_var, slate_var, prio_var, prio_mix, nhl_db_translat
|
|
| 1543 |
}]}).limit(_mix_seed_limit_primary(lineup_num, prio_mix))
|
| 1544 |
cursor2 = collection.find({'$and': [filter_query, {'salary': {'$gte': salary_min, '$lte': salary_max}, 'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 1545 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
| 1546 |
-
}]}).sort('Own', -1).limit(
|
| 1547 |
else:
|
| 1548 |
cursor1 = collection.find({'salary': {'$gte': salary_min, '$lte': salary_max}, 'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 1549 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
|
@@ -2031,7 +2031,7 @@ def init_FD_MLB_lineups(type_var, slate_var, prio_var, prio_mix, mlb_db_translat
|
|
| 2031 |
}]}).limit(_mix_seed_limit_primary(lineup_num, prio_mix))
|
| 2032 |
cursor2 = collection.find({'$and': [filter_query, {'salary': {'$gte': salary_min, '$lte': salary_max}, 'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 2033 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
| 2034 |
-
}]}).sort('Own', -1).limit(
|
| 2035 |
else:
|
| 2036 |
cursor1 = collection.find({'salary': {'$gte': salary_min, '$lte': salary_max}, 'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 2037 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
|
|
|
| 528 |
cursor2 = collection.find({'$and': [filter_query, {'salary': {'$gte': salary_min, '$lte': salary_max},
|
| 529 |
'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 530 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
| 531 |
+
}]}).sort('Own', -1).limit(_mix_seed_limit_secondary(lineup_num, prio_mix))
|
| 532 |
else:
|
| 533 |
cursor1 = collection.find({'salary': {'$gte': salary_min, '$lte': salary_max},
|
| 534 |
'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
|
|
|
| 1055 |
cursor2 = collection.find({'$and': [filter_query, {'salary': {'$gte': salary_min, '$lte': salary_max},
|
| 1056 |
'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 1057 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
| 1058 |
+
}]}).sort('Own', -1).limit(_mix_seed_limit_secondary(lineup_num, prio_mix))
|
| 1059 |
else:
|
| 1060 |
cursor1 = collection.find({'salary': {'$gte': salary_min, '$lte': salary_max}, 'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 1061 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
|
|
|
| 1543 |
}]}).limit(_mix_seed_limit_primary(lineup_num, prio_mix))
|
| 1544 |
cursor2 = collection.find({'$and': [filter_query, {'salary': {'$gte': salary_min, '$lte': salary_max}, 'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 1545 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
| 1546 |
+
}]}).sort('Own', -1).limit(_mix_seed_limit_secondary(lineup_num, prio_mix))
|
| 1547 |
else:
|
| 1548 |
cursor1 = collection.find({'salary': {'$gte': salary_min, '$lte': salary_max}, 'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 1549 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
|
|
|
| 2031 |
}]}).limit(_mix_seed_limit_primary(lineup_num, prio_mix))
|
| 2032 |
cursor2 = collection.find({'$and': [filter_query, {'salary': {'$gte': salary_min, '$lte': salary_max}, 'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 2033 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|
| 2034 |
+
}]}).sort('Own', -1).limit(_mix_seed_limit_secondary(lineup_num, prio_mix))
|
| 2035 |
else:
|
| 2036 |
cursor1 = collection.find({'salary': {'$gte': salary_min, '$lte': salary_max}, 'Team_count': {'$gte': team_count_min if team_count_min is not None else 1, '$lte': team_count_max if team_count_max is not None else 999},
|
| 2037 |
'Secondary_count': {'$gte': secondary_team_count_min if secondary_team_count_min is not None else 1, '$lte': secondary_team_count_max if secondary_team_count_max is not None else 999},
|