Compare commits
3 Commits
8b4ee3b289
...
fc8592f8ab
Author | SHA1 | Date | |
---|---|---|---|
fc8592f8ab | |||
195d240a87 | |||
df16497476 |
@ -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, Team, engine
|
||||
from cutt.db import Chemistry, MVPRanking, Player, PlayerTeamLink, Team, engine
|
||||
import networkx as nx
|
||||
import numpy as np
|
||||
import matplotlib
|
||||
@ -63,8 +63,12 @@ def graph_json(
|
||||
edges = []
|
||||
player_map = {}
|
||||
with Session(engine) as session:
|
||||
statement = select(Team).where(Team.id == request.team_id)
|
||||
players = [t.players for t in session.exec(statement)][0]
|
||||
players = session.exec(
|
||||
select(P)
|
||||
.join(PlayerTeamLink)
|
||||
.join(Team)
|
||||
.where(Team.id == request.team_id, P.disabled == False)
|
||||
).all()
|
||||
if not players:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
|
||||
for p in players:
|
||||
@ -227,8 +231,12 @@ def mvp(
|
||||
):
|
||||
ranks = dict()
|
||||
with Session(engine) as session:
|
||||
statement = select(Team).where(Team.id == request.team_id)
|
||||
players = [t.players for t in session.exec(statement)][0]
|
||||
players = session.exec(
|
||||
select(P)
|
||||
.join(PlayerTeamLink)
|
||||
.join(Team)
|
||||
.where(Team.id == request.team_id, P.disabled == False)
|
||||
).all()
|
||||
if not players:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
|
||||
player_map = {p.id: p.display_name for p in players}
|
||||
@ -268,8 +276,12 @@ async def turnout(
|
||||
):
|
||||
player_map = {}
|
||||
with Session(engine) as session:
|
||||
statement = select(Team).where(Team.id == request.team_id)
|
||||
players = [t.players for t in session.exec(statement)][0]
|
||||
players = session.exec(
|
||||
select(P)
|
||||
.join(PlayerTeamLink)
|
||||
.join(Team)
|
||||
.where(Team.id == request.team_id, P.disabled == False)
|
||||
).all()
|
||||
if not players:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND)
|
||||
for p in players:
|
||||
|
@ -20,6 +20,10 @@ 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">
|
||||
|
@ -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 = Math.max(3, players.length) * 40;
|
||||
const height = (players.length + 1) * 40;
|
||||
|
||||
useEffect(() => {
|
||||
const handleResize = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user