refactor on deck to continue reading and show percentages on home

This commit is contained in:
Jared Turner
2020-05-20 10:38:23 +01:00
parent c35e840694
commit a2c7638141
3 changed files with 14 additions and 10 deletions

View File

@@ -71,10 +71,14 @@ class MainRouter < Router
# map: get the on-deck entry or nil for each Title
# select: select only entries (and ignore Nil's) from the array
# produced by map
on_deck_entries = titles.map { |t|
t.get_on_deck_entry username
continue_reading_entries = titles.map { |t|
t.get_continue_reading_entry username
}.select Entry
percentage = continue_reading_entries.map do |e|
e.book.load_percentage username, e.title
end
layout "home"
rescue e
@context.error e