mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-05 12:25:32 -04:00
Refactor the /
route
This commit is contained in:
parent
ff6e64f12a
commit
c35e840694
@ -68,11 +68,12 @@ class MainRouter < Router
|
|||||||
titles = @context.library.titles
|
titles = @context.library.titles
|
||||||
username = get_username env
|
username = get_username env
|
||||||
|
|
||||||
on_deck_entries = [] of Entry
|
# map: get the on-deck entry or nil for each Title
|
||||||
titles.each do |title|
|
# select: select only entries (and ignore Nil's) from the array
|
||||||
on_deck_entry = title.get_on_deck_entry username
|
# produced by map
|
||||||
on_deck_entries << on_deck_entry if on_deck_entry # ingnore titles without latest on deck entry
|
on_deck_entries = titles.map { |t|
|
||||||
end
|
t.get_on_deck_entry username
|
||||||
|
}.select Entry
|
||||||
|
|
||||||
layout "home"
|
layout "home"
|
||||||
rescue e
|
rescue e
|
||||||
|
Loading…
x
Reference in New Issue
Block a user