mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 19:05:32 -04:00
Use sorted_titles
This commit is contained in:
parent
234b29bbdd
commit
8fea35fa51
@ -252,6 +252,10 @@ class Title
|
|||||||
@title_ids.map { |tid| Library.default.get_title! tid }
|
@title_ids.map { |tid| Library.default.get_title! tid }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sorted_titles(username, opt : SortOptions? = nil)
|
||||||
|
titles
|
||||||
|
end
|
||||||
|
|
||||||
# Get all entries, including entries in nested titles
|
# Get all entries, including entries in nested titles
|
||||||
def deep_entries
|
def deep_entries
|
||||||
return @entries if title_ids.empty?
|
return @entries if title_ids.empty?
|
||||||
|
@ -61,9 +61,15 @@ struct MainRouter
|
|||||||
sort_opt = SortOptions.from_info_json title.dir, username
|
sort_opt = SortOptions.from_info_json title.dir, username
|
||||||
get_and_save_sort_opt title.dir
|
get_and_save_sort_opt title.dir
|
||||||
|
|
||||||
|
sorted_titles = title.sorted_titles username, sort_opt
|
||||||
entries = title.sorted_entries username, sort_opt
|
entries = title.sorted_entries username, sort_opt
|
||||||
percentage = title.load_percentage_for_all_entries username, sort_opt
|
percentage = title.load_percentage_for_all_entries username, sort_opt
|
||||||
title_percentage = title.titles.map &.load_percentage username
|
title_percentage = title.titles.map &.load_percentage username
|
||||||
|
title_percentage_map = {} of String => Float64
|
||||||
|
title_percentage.each_with_index do |percentage, i|
|
||||||
|
t = title.titles[i]
|
||||||
|
title_percentage_map[t.id] = percentage
|
||||||
|
end
|
||||||
|
|
||||||
layout "title"
|
layout "title"
|
||||||
rescue e
|
rescue e
|
||||||
|
@ -60,8 +60,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="uk-child-width-1-4@m uk-child-width-1-2" uk-grid>
|
<div class="uk-child-width-1-4@m uk-child-width-1-2" uk-grid>
|
||||||
<% title.titles.each_with_index do |item, i| %>
|
<% sorted_titles.each do |item| %>
|
||||||
<% progress = title_percentage[i] %>
|
<% progress = title_percentage_map[item.id] %>
|
||||||
<%= render_component "card" %>
|
<%= render_component "card" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user