Skip to content

Commit

Permalink
Fix compatibility with older pretix versions
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Nov 24, 2023
1 parent f22c915 commit efb20e4
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,21 @@ class OnlineCheckProvider(
for (i in 0 until (posjson.getJSONArray("answers").length())) {
val a = posjson.getJSONArray("answers").getJSONObject(i)
val value = a.getString("answer")
val q = a.getJSONObject("question")
val question = Question()
question.setServer_id(q.getLong("id"))
question.isRequired = q.getBoolean("required")
question.setPosition(q.getLong("position"))
question.setJson_data(q.toString())
if (question.isShowDuringCheckin) {
shownAnswers.add(TicketCheckProvider.QuestionAnswer(question, value))
val q = a.get("question")
if (q is JSONObject) { // pretix version supports the expand parameter
val question = Question()
question.setServer_id(q.getLong("id"))
question.isRequired = q.getBoolean("required")
question.setPosition(q.getLong("position"))
question.setJson_data(q.toString())
if (question.isShowDuringCheckin) {
shownAnswers.add(
TicketCheckProvider.QuestionAnswer(
question,
value
)
)
}
}
}
res.shownAnswers = shownAnswers
Expand Down

0 comments on commit efb20e4

Please sign in to comment.