Skip to content

Commit b4b169a

Browse files
prathamgupta36robwaz
authored andcommitted
revert the old approach changes
1 parent 2256c34 commit b4b169a

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

dojo_plugin/utils/dojo.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -658,16 +658,7 @@ def dojo_create(user, repository, public_key, private_key, spec):
658658
deploy_url = f"https://github.com/{repository}/settings/keys"
659659
raise RuntimeError(f"Failed to clone: <a href='{deploy_url}' target='_blank'>add deploy key</a>")
660660

661-
except IntegrityError as e:
662-
db.session.rollback()
663-
if "dojo_challenges_dojo_id_module_index_id_key" in str(e):
664-
match = re.search(r"Key \(dojo_id, module_index, id\)=\((?P<dojo_id>\d+), (?P<module_index>\d+), '(?P<challenge_id>[^']*)'\) already exists", str(e))
665-
if match:
666-
challenge_id = match.group("challenge_id")
667-
module_index = int(match.group("module_index"))
668-
module = next((m for m in dojo.modules if m.module_index == module_index), None)
669-
module_id = module.id if module else "unknown"
670-
raise RuntimeError(f"Duplicate challenge id: '{challenge_id}' in module '{module_id}'")
661+
except IntegrityError:
671662
raise RuntimeError("This repository already exists as a dojo")
672663

673664
except AssertionError as e:

0 commit comments

Comments
 (0)