PlanB-Network / bitcoin-learning-management-system

PlanB Network
20 stars 17 forks source link

[bug] Division by Zero Error in completeChapterProcedure #688

Closed max-lt closed 14 hours ago

max-lt commented 3 weeks ago

The completeChapterProcedure can fail badly (err: div by zero) when applied to a non-english course; query completeChapterQuery can fail on (chapter_count.completed_count::FLOAT / total_chapters.total) if total_chapters.total is 0.

To reproduce:

You will have a "division by zero" error response

trigger67 commented 3 weeks ago

Issue il linked to hardcoded 'en' in the query, and btc205 has no english version ...

We could have same issue with the "getTickets" query that uses 'en'.

We need to update these 2 queries to make the code more robust to "non english" courses.