-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AttackDefTeam #69
base: master
Are you sure you want to change the base?
Conversation
@router.get("/round2/list") | ||
async def ctf_list(jwt: RequireJwt): | ||
team_id = jwt["team_id"] | ||
attack_def_team = await AttackDefTeam.get(team_id=team_id) | ||
if (attack_def_team is None): | ||
return {"msg_code": config.msg_codes["attack_def_team_not_found"]} | ||
problems = await Problem_Pydantic.from_queryset(Problem.filter(attackdefproblem__attack_def_team__id=attack_def_team.id)) | ||
return await calculate_problem_points(problems, team_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not fetch the CTFs for all teams. It only fetches the CTFs assigned to the team calling this endpoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a separate path /round2/list_all
to return all problems. From this endpoint, we do not calculate actual points based on hints used.
Is this what you wanted?
src/pwncore/config.py
Outdated
powerups={ | ||
PowerUpType.UPGRADE: { | ||
"cost": 100, | ||
}, | ||
PowerUpType.SHIELD: { | ||
"duration": timedelta(seconds=10), | ||
"cost": 200, | ||
}, | ||
PowerUpType.POINT_SIPHON: { | ||
"duration": timedelta(seconds=15), | ||
"cost": 150, | ||
}, | ||
PowerUpType.SABOTAGE: { | ||
"duration": timedelta(seconds=5), | ||
"cost": 500, | ||
}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert to a dataclass and have add field count as max number of uses. Validate to ensure maximum uses is not exceeded when consuming the powerup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converted to dataclass, however I did not write logic for using power-ups yet.
Added new model with two new routes under '/ctf/round2/list' and '/team/round2/powerups' to list a team's ctfs and used powerups respectively.
Also added test rows in admin init for new models.
Fixes: #52