Compare commits

..

No commits in common. "fc8592f8abf01701428cab8decac43190ae40c65" and "8b4ee3b28997a66a324598b913263b7752590a22" have entirely different histories.

3 changed files with 8 additions and 24 deletions

View File

@ -6,7 +6,7 @@ from fastapi.responses import JSONResponse
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from sqlmodel import Session, func, select from sqlmodel import Session, func, select
from sqlmodel.sql.expression import SelectOfScalar from sqlmodel.sql.expression import SelectOfScalar
from cutt.db import Chemistry, MVPRanking, Player, PlayerTeamLink, Team, engine from cutt.db import Chemistry, MVPRanking, Player, Team, engine
import networkx as nx import networkx as nx
import numpy as np import numpy as np
import matplotlib import matplotlib
@ -63,12 +63,8 @@ def graph_json(
edges = [] edges = []
player_map = {} player_map = {}
with Session(engine) as session: with Session(engine) as session:
players = session.exec( statement = select(Team).where(Team.id == request.team_id)
select(P) players = [t.players for t in session.exec(statement)][0]
.join(PlayerTeamLink)
.join(Team)
.where(Team.id == request.team_id, P.disabled == False)
).all()
if not players: if not players:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND) raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
for p in players: for p in players:
@ -231,12 +227,8 @@ def mvp(
): ):
ranks = dict() ranks = dict()
with Session(engine) as session: with Session(engine) as session:
players = session.exec( statement = select(Team).where(Team.id == request.team_id)
select(P) players = [t.players for t in session.exec(statement)][0]
.join(PlayerTeamLink)
.join(Team)
.where(Team.id == request.team_id, P.disabled == False)
).all()
if not players: if not players:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND) raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
player_map = {p.id: p.display_name for p in players} player_map = {p.id: p.display_name for p in players}
@ -276,12 +268,8 @@ async def turnout(
): ):
player_map = {} player_map = {}
with Session(engine) as session: with Session(engine) as session:
players = session.exec( statement = select(Team).where(Team.id == request.team_id)
select(P) players = [t.players for t in session.exec(statement)][0]
.join(PlayerTeamLink)
.join(Team)
.where(Team.id == request.team_id, P.disabled == False)
).all()
if not players: if not players:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND) raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
for p in players: for p in players:

View File

@ -20,10 +20,6 @@ export default function Footer() {
<Link to="/mvp"> <Link to="/mvp">
<span>MVP</span> <span>MVP</span>
</Link> </Link>
<span>|</span>
<Link to="/team">
<span>Team</span>
</Link>
</div> </div>
)} )}
<p className="grey extra-margin"> <p className="grey extra-margin">

View File

@ -16,7 +16,7 @@ const determineNiceWidth = (width: number) => {
const RaceChart: FC<RaceChartProps> = ({ players, std }) => { const RaceChart: FC<RaceChartProps> = ({ players, std }) => {
const [width, setWidth] = useState(determineNiceWidth(window.innerWidth)); const [width, setWidth] = useState(determineNiceWidth(window.innerWidth));
//const [height, setHeight] = useState(window.innerHeight); //const [height, setHeight] = useState(window.innerHeight);
const height = (players.length + 1) * 40; const height = Math.max(3, players.length) * 40;
useEffect(() => { useEffect(() => {
const handleResize = () => { const handleResize = () => {