Skip to content

Commit 2ecaf6b

Browse files
authored
Merge pull request ianding1#3 from harveyghq/master
fix div-zero err in new problem's ac_rate
2 parents 46e4554 + 8e55a1a commit 2ecaf6b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

autoload/leetcode.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ def _get_category_problems(category):
217217
'title': p['stat']['question__title'],
218218
'slug': p['stat']['question__title_slug'],
219219
'paid_only': p['paid_only'],
220-
'ac_rate': p['stat']['total_acs'] / p['stat']['total_submitted'],
220+
'ac_rate': p['stat']['total_acs'] / p['stat']['total_submitted'] if \
221+
p['stat']['total_submitted'] > 0 else 0,
221222
'level': _level_to_name(p['difficulty']['level']),
222223
'favor': p['is_favor'],
223224
'category': content['category_slug'],

0 commit comments

Comments
 (0)