When a title has no entry as immediate child, always return 0 as the reading progress

This commit is contained in:
Alex Ling 2020-03-15 02:30:18 +00:00
parent 4aeda53806
commit 7774efa471

View File

@ -212,6 +212,7 @@ class Title
page / entry_obj.pages
end
def load_percetage(username)
return 0 if @entries.empty?
read_pages = total_pages = 0
@entries.each do |e|
read_pages += load_progress username, e.title