changed "subleague" to "conference"

This commit is contained in:
Sakimori 2021-03-24 17:43:03 -04:00
parent 32b8b3f1de
commit 4e3ac41ff1
5 changed files with 43267 additions and 12 deletions

View file

@ -315,7 +315,7 @@ class league_structure(object):
this_embed.add_field(name=league_db.get_past_champion(self.name, season_num), value=f"Season {season_num} champions", inline = False) this_embed.add_field(name=league_db.get_past_champion(self.name, season_num), value=f"Season {season_num} champions", inline = False)
for subleague in iter(self.league.keys()): for subleague in iter(self.league.keys()):
this_embed.add_field(name="Subleague:", value=f"**{subleague}**", inline = False) this_embed.add_field(name="Conference:", value=f"**{subleague}**", inline = False)
for division in iter(self.league[subleague].keys()): for division in iter(self.league[subleague].keys()):
teams = self.division_standings(self.league[subleague][division], standings) teams = self.division_standings(self.league[subleague][division], standings)
@ -346,7 +346,7 @@ class league_structure(object):
for team_name, wins, losses, run_diff in league_db.get_standings(self.name): for team_name, wins, losses, run_diff in league_db.get_standings(self.name):
standings[team_name] = {"wins" : wins, "losses" : losses, "run_diff" : run_diff} standings[team_name] = {"wins" : wins, "losses" : losses, "run_diff" : run_diff}
for subleague in iter(self.league.keys()): for subleague in iter(self.league.keys()):
this_embed.add_field(name="Subleague:", value=f"**{subleague}**", inline = False) this_embed.add_field(name="Conference:", value=f"**{subleague}**", inline = False)
for division in iter(self.league[subleague].keys()): for division in iter(self.league[subleague].keys()):
teams = self.division_standings(self.league[subleague][division], standings) teams = self.division_standings(self.league[subleague][division], standings)
@ -418,7 +418,7 @@ class league_structure(object):
else: else:
teams_string += f"**{this_team[0].name}\n**{this_team[1]} - {this_team[2]} WR: - GB: {this_team[4]}\n\n" teams_string += f"**{this_team[0].name}\n**{this_team[1]} - {this_team[2]} WR: - GB: {this_team[4]}\n\n"
this_embed.add_field(name=f"{subleague} League:", value=teams_string, inline = False) this_embed.add_field(name=f"{subleague} Conference:", value=teams_string, inline = False)
this_embed.set_footer(text=f"Wildcard standings as of day {self.day-1}") this_embed.set_footer(text=f"Wildcard standings as of day {self.day-1}")
return this_embed return this_embed
@ -445,7 +445,7 @@ class league_structure(object):
for this_team, wins, losses, diff, gb in division_leaders + wildcard_leaders: for this_team, wins, losses, diff, gb in division_leaders + wildcard_leaders:
team_dic[this_team] = {"wins" : wins} team_dic[this_team] = {"wins" : wins}
subleague_tournament = tournament(f"{self.name} {subleague} Subleague Series", team_dic, series_length=3, finals_series_length=5, secs_between_games=int(3600/self.games_per_hour), secs_between_rounds=int(7200/self.games_per_hour)) subleague_tournament = tournament(f"{self.name} {subleague} Conference Series", team_dic, series_length=3, finals_series_length=5, secs_between_games=int(3600/self.games_per_hour), secs_between_rounds=int(7200/self.games_per_hour))
subleague_tournament.build_bracket(by_wins = True) subleague_tournament.build_bracket(by_wins = True)
subleague_tournament.league = self subleague_tournament.league = self
tournaments.append(subleague_tournament) tournaments.append(subleague_tournament)

View file

@ -50,7 +50,7 @@ def create_league():
return jsonify({'status':'err_league_exists'}), 400 return jsonify({'status':'err_league_exists'}), 400
num_subleagues = len(config['structure']['subleagues']) num_subleagues = len(config['structure']['subleagues'])
if num_subleagues < 1 or num_subleagues % 2 != 0: if num_subleagues < 1:
return jsonify({'status':'err_invalid_subleague_count'}), 400 return jsonify({'status':'err_invalid_subleague_count'}), 400
num_divisions = len(config['structure']['subleagues'][0]['divisions']) num_divisions = len(config['structure']['subleagues'][0]['divisions'])

View file

@ -374,7 +374,7 @@ function LeagueStructre(props: {
} }
</div> </div>
</div> </div>
<div className="cl_structure_err">{props.state.subleagues.length % 2 !== 0 && props.showError ? "Must have an even number of subleagues." : ""}</div> <div className="cl_structure_err">{props.state.subleagues.length % 2 !== 0 && props.showError ? "Must have an even number of conferences." : ""}</div>
{ nSubleagues * (nDivisions+2) < MAX_SUBLEAGUE_DIVISION_TOTAL ? { nSubleagues * (nDivisions+2) < MAX_SUBLEAGUE_DIVISION_TOTAL ?
<button className="cl_division_add" onClick={e => props.dispatch({type: 'add_divisions'})}></button>: <button className="cl_division_add" onClick={e => props.dispatch({type: 'add_divisions'})}></button>:
<div className="cl_division_add_filler"/> <div className="cl_division_add_filler"/>
@ -392,7 +392,7 @@ function SubleagueHeaders(props: {subleagues: SubleagueState[], dispatch: React.
subleague.name === "" ? subleague.name === "" ?
"A name is required." : "A name is required." :
props.subleagues.slice(0, i).some(val => val.name === subleague.name) ? props.subleagues.slice(0, i).some(val => val.name === subleague.name) ?
"Each subleague must have a different name." : "Each conference must have a different name." :
""; "";
return ( return (
@ -413,7 +413,7 @@ function SubleagueHeaders(props: {subleagues: SubleagueState[], dispatch: React.
function SubleageHeader(props: {state: SubleagueState, canDelete: boolean, dispatch:(action: DistributiveOmit<StructureReducerActions, 'subleague_index'>) => void}) { function SubleageHeader(props: {state: SubleagueState, canDelete: boolean, dispatch:(action: DistributiveOmit<StructureReducerActions, 'subleague_index'>) => void}) {
return ( return (
<div className="cl_subleague_header"> <div className="cl_subleague_header">
<input type="text" className="cl_subleague_name" placeholder="Subleague Name" value={props.state.name} onChange={e => <input type="text" className="cl_subleague_name" placeholder="Conference Name" value={props.state.name} onChange={e =>
props.dispatch({type: 'rename_subleague', name: e.target.value}) props.dispatch({type: 'rename_subleague', name: e.target.value})
}/> }/>
{props.canDelete ? <button className="cl_subleague_delete" onClick={e => props.dispatch({type: 'remove_subleague'})}></button> : null} {props.canDelete ? <button className="cl_subleague_delete" onClick={e => props.dispatch({type: 'remove_subleague'})}></button> : null}
@ -483,7 +483,7 @@ function Division(props: {
props.state.name === "" ? props.state.name === "" ?
"A name is required." : "A name is required." :
props.isDuplicate ? props.isDuplicate ?
"Each division in a subleague must have a different name." : "Each division in a conference must have a different name." :
"" ""
let teamsErr = props.state.teams.length < 2 ? "Must have at least 2 teams." : ""; let teamsErr = props.state.teams.length < 2 ? "Must have at least 2 teams." : "";
@ -584,7 +584,7 @@ function LeagueOptions(props: {state: LeagueOptionsState, dispatch: React.Dispat
props.dispatch({type: 'set_intra_division_series', value: value})} showError={props.showError}/> props.dispatch({type: 'set_intra_division_series', value: value})} showError={props.showError}/>
<NumberInput title="Number of inter-divisional series" value={props.state.inter_division_series} setValue={(value: string) => <NumberInput title="Number of inter-divisional series" value={props.state.inter_division_series} setValue={(value: string) =>
props.dispatch({type: 'set_inter_division_series', value: value})} showError={props.showError}/> props.dispatch({type: 'set_inter_division_series', value: value})} showError={props.showError}/>
<NumberInput title="Number of inter-league series" value={props.state.inter_league_series} setValue={(value: string) => <NumberInput title="Number of inter-conference series" value={props.state.inter_league_series} setValue={(value: string) =>
props.dispatch({type: 'set_inter_league_series', value: value})} showError={props.showError}/> props.dispatch({type: 'set_inter_league_series', value: value})} showError={props.showError}/>
</div> </div>
</div> </div>

File diff suppressed because it is too large Load diff

View file

@ -1212,8 +1212,8 @@ class LeagueSwapTeamCommand(Command):
class LeagueRenameCommand(Command): class LeagueRenameCommand(Command):
name = "leaguerename" name = "leaguerename"
template = "m;leaguerename [league name]\n[old subleague/division name]\n[new subleague/division name]" template = "m;leaguerename [league name]\n[old conference/division name]\n[new conference/division name]"
description = "Changes the name of an existing subleague or division. Can only be executed by a league owner, and only before the start of a new season." description = "Changes the name of an existing conference or division. Can only be executed by a league owner, and only before the start of a new season."
async def execute(self, msg, command): async def execute(self, msg, command):
league_name = command.split("\n")[0].strip() league_name = command.split("\n")[0].strip()