Skip to content

Commit

Permalink
fix: include '@' symbol in problem id regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Feb 19, 2024
1 parent 7011204 commit 788d9b8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion macros/get_problem_id.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
-- either the problem id is at the end of the object ID
-- or is followed by '/answer' or '/hint'
{% macro get_problem_id(object_id) %}
regexpExtract(object_id, 'xblock/([\w\d-\+:]*@problem\+block@[\w\d][^_]*)(_\d_\d)?', 1)
coalesce(
regexpExtract(object_id, 'xblock/([\w\d-\+:]*@problem\+block@[\w\d][^_]*)(_\d_\d)?', 1),
regexpExtract(object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_]*)(_\d_\d)?', 1),
''
)
{% endmacro %}

0 comments on commit 788d9b8

Please sign in to comment.