Entry selector on reader page (closes #168)

This commit is contained in:
Alex Ling
2021-03-05 17:02:45 +00:00
parent 8aab113aab
commit 05b4e77fa9
5 changed files with 57 additions and 24 deletions
+4 -3
View File
@@ -134,10 +134,11 @@ class Entry
entries[idx + 1]
end
def previous_entry
idx = @book.entries.index self
def previous_entry(username)
entries = @book.sorted_entries username
idx = entries.index self
return nil if idx.nil? || idx == 0
@book.entries[idx - 1]
entries[idx - 1]
end
def date_added
+1 -1
View File
@@ -121,7 +121,7 @@ class Library
# Get the last read time of the entry. If it hasn't been started, get
# the last read time of the previous entry
last_read = e.load_last_read username
pe = e.previous_entry
pe = e.previous_entry username
if last_read.nil? && pe
last_read = pe.load_last_read username
end