Skip to content

Commit

Permalink
Adapt diffrent mode for ctfd-matrix-scoreboard plugin & fix bugs (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
0akarma committed Dec 15, 2019
1 parent 4a95376 commit 594437b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
14 changes: 9 additions & 5 deletions CTFd/plugins/ctfd-matrix-scoreboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ def get_standings():
jstandings = []
# print(standings)
for team in standings:
print(team)
teamid = team[0]
# To do 区分模式
solves = db.session.query(Solves.challenge_id.label('chalid'), Solves.date.label('date')).filter(Solves.team_id==teamid)
mode = utils.get_config("user_mode")
if mode == "teams":
teamid = Users.query.filter_by(id=team[0]).first_or_404().team_id
solves = db.session.query(Solves.challenge_id.label('chalid'), Solves.date.label('date')).filter(
Solves.team_id == teamid)
else:
teamid = team[0]
solves = db.session.query(Solves.challenge_id.label('chalid'), Solves.date.label('date')).filter(
Solves.user_id == teamid)

freeze = utils.get_config('freeze')
if freeze:
Expand Down Expand Up @@ -67,7 +72,6 @@ def get_standings():
score = score + int(cvalue * 1)
jsolves.append(solve)

mode = utils.get_config("user_mode")
if mode == "teams":
jstandings.append({'userid':"", 'teamid':team[0], 'score':score, 'name':team[2],'solves':jsolves})
else:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ <h1>Scoreboard has been frozen.</h1>
</th>
<th width="5%" rowspan="2"><b>Score</b>
</th>
<!-- TODO: 可适应布局调整 -->
{% for chal in challenges %}
<div><th class="chalname" title="{{ chal.category }}"><div><span>{{ chal.name }}</span></div></th></div>
{% endfor %}
Expand Down

0 comments on commit 594437b

Please sign in to comment.