Skip to content

Commit

Permalink
Fixes #215
Browse files Browse the repository at this point in the history
  • Loading branch information
jdabtieu committed Aug 5, 2023
1 parent f2c64d1 commit fcc96fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/templates/contest/export_problem.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ <h1>Export <a href="{{ request.path[:-7] }}">{{ data["name"] }}</a></h1>
<p>
Are you sure you want to export {{ data["name"] }} to the Practice tab?
</p>
{% if data["instanced"] %}
<p style="color: red"><b>
Because this problem is instanced, you will need to create a new entry in the instancer.
Simply copy the config of <code>{{ data["contest_id"] }}/{{ data["problem_id"] }}</code> to
<code>{{ data["contest_id"] }}-{{ data["problem_id"] }}</code>.
</b></p>
{% endif %}
<form method="post">
<div class="form-floating">
<input class="form-control mb-3" id="pv" type="number" name="point_value" placeholder="New Point Value: (Empty to Keep Original)">
Expand Down
8 changes: 4 additions & 4 deletions src/views/contest.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,10 @@ def export_contest_problem(contest_id, problem_id):
new_points = data[0]["point_value"]

# Insert into problems databases
db.execute(("INSERT INTO problems(id, name, point_value, category, flag) "
"VALUES(:id, :name, :pv, :cat, :flag)"),
id=new_id, name=new_name, pv=new_points,
cat=data[0]["category"], flag=data[0]["flag"])
db.execute(("INSERT INTO problems(id, name, point_value, category, flag, flag_hint, "
"instanced) VALUES(?, ?, ?, ?, ?, ?, ?)"),
new_id, new_name, new_points, data[0]["category"], data[0]["flag"],
data[0]["flag_hint"], data[0]["instanced"])

db.execute("INSERT INTO problem_solved(user_id, problem_id) SELECT user_id, :new_id "
"FROM contest_solved WHERE contest_id=:cid AND problem_id=:pid",
Expand Down

0 comments on commit fcc96fa

Please sign in to comment.