From fcc96fae42ed7d035c2f5c60a49372a71f5f3d24 Mon Sep 17 00:00:00 2001 From: Jonathan Wu Date: Sat, 5 Aug 2023 10:47:58 -0400 Subject: [PATCH] Fixes #215 --- src/templates/contest/export_problem.html | 7 +++++++ src/views/contest.py | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/templates/contest/export_problem.html b/src/templates/contest/export_problem.html index 6749976..30dcdd2 100644 --- a/src/templates/contest/export_problem.html +++ b/src/templates/contest/export_problem.html @@ -8,6 +8,13 @@

Export {{ data["name"] }}

Are you sure you want to export {{ data["name"] }} to the Practice tab?

+{% if data["instanced"] %} +

+ Because this problem is instanced, you will need to create a new entry in the instancer. + Simply copy the config of {{ data["contest_id"] }}/{{ data["problem_id"] }} to + {{ data["contest_id"] }}-{{ data["problem_id"] }}. +

+{% endif %}
diff --git a/src/views/contest.py b/src/views/contest.py index b597dc5..e527a86 100644 --- a/src/views/contest.py +++ b/src/views/contest.py @@ -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",