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 sqlmodel import Session, func, select
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 numpy as np
import matplotlib
@ -63,12 +63,8 @@ def graph_json(
edges = []
player_map = {}
with Session(engine) as session:
players = session.exec(
select(P)
.join(PlayerTeamLink)
.join(Team)
.where(Team.id == request.team_id, P.disabled == False)
).all()
statement = select(Team).where(Team.id == request.team_id)
players = [t.players for t in session.exec(statement)][0]
if not players:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
for p in players:
@ -231,12 +227,8 @@ def mvp(
):
ranks = dict()
with Session(engine) as session:
players = session.exec(
select(P)
.join(PlayerTeamLink)
.join(Team)
.where(Team.id == request.team_id, P.disabled == False)
).all()
statement = select(Team).where(Team.id == request.team_id)
players = [t.players for t in session.exec(statement)][0]
if not players:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
player_map = {p.id: p.display_name for p in players}
@ -276,12 +268,8 @@ async def turnout(
):
player_map = {}
with Session(engine) as session:
players = session.exec(
select(P)
.join(PlayerTeamLink)
.join(Team)
.where(Team.id == request.team_id, P.disabled == False)
).all()
statement = select(Team).where(Team.id == request.team_id)
players = [t.players for t in session.exec(statement)][0]
if not players:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
for p in players:

View File

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

View File

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