mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 10:55:30 -04:00
Fix lint
This commit is contained in:
parent
0f94288bab
commit
b711072492
@ -127,7 +127,8 @@ struct Tuple(*T)
|
||||
end
|
||||
end
|
||||
|
||||
alias CacheableType = Array(Entry) | Array(Title) | String | Tuple(String, Int32)
|
||||
alias CacheableType = Array(Entry) | Array(Title) | String |
|
||||
Tuple(String, Int32)
|
||||
alias CacheEntryType = SortedEntriesCacheEntry |
|
||||
SortedTitlesCacheEntry |
|
||||
CacheEntry(String, String) |
|
||||
|
@ -522,7 +522,9 @@ class Title
|
||||
|
||||
case opt.not_nil!.method
|
||||
when .title?
|
||||
ary = @entries.sort { |a, b| compare_numerically a.sort_title, b.sort_title }
|
||||
ary = @entries.sort do |a, b|
|
||||
compare_numerically a.sort_title, b.sort_title
|
||||
end
|
||||
when .time_modified?
|
||||
ary = @entries.sort { |a, b| (a.mtime <=> b.mtime).or \
|
||||
compare_numerically a.sort_title, b.sort_title }
|
||||
|
@ -66,9 +66,9 @@ struct MainRouter
|
||||
percentage = title.load_percentage_for_all_entries username, sort_opt
|
||||
title_percentage = title.titles.map &.load_percentage username
|
||||
title_percentage_map = {} of String => Float64
|
||||
title_percentage.each_with_index do |percentage, i|
|
||||
title_percentage.each_with_index do |tp, i|
|
||||
t = title.titles[i]
|
||||
title_percentage_map[t.id] = percentage
|
||||
title_percentage_map[t.id] = tp
|
||||
end
|
||||
|
||||
layout "title"
|
||||
|
@ -346,7 +346,9 @@ class Storage
|
||||
sort_title = nil
|
||||
MainFiber.run do
|
||||
get_db do |db|
|
||||
sort_title = db.query_one? "Select sort_title from titles where id = (?)", title_id, as: String | Nil
|
||||
sort_title =
|
||||
db.query_one? "Select sort_title from titles where id = (?)",
|
||||
title_id, as: String | Nil
|
||||
end
|
||||
end
|
||||
sort_title
|
||||
@ -356,7 +358,8 @@ class Storage
|
||||
sort_title = nil if sort_title == ""
|
||||
MainFiber.run do
|
||||
get_db do |db|
|
||||
db.exec "update titles set sort_title = (?) where id = (?)", sort_title, title_id
|
||||
db.exec "update titles set sort_title = (?) where id = (?)",
|
||||
sort_title, title_id
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -365,7 +368,9 @@ class Storage
|
||||
sort_title = nil
|
||||
MainFiber.run do
|
||||
get_db do |db|
|
||||
sort_title = db.query_one? "Select sort_title from ids where id = (?)", entry_id, as: String | Nil
|
||||
sort_title =
|
||||
db.query_one? "Select sort_title from ids where id = (?)",
|
||||
entry_id, as: String | Nil
|
||||
end
|
||||
end
|
||||
sort_title
|
||||
@ -375,7 +380,8 @@ class Storage
|
||||
results = Hash(String, String | Nil).new
|
||||
MainFiber.run do
|
||||
get_db do |db|
|
||||
db.query "select id, sort_title from ids where id in (#{ids.join "," { |id| "'#{id}'" }})" do |rs|
|
||||
db.query "select id, sort_title from ids where id in " \
|
||||
"(#{ids.join "," { |id| "'#{id}'" }})" do |rs|
|
||||
rs.each do
|
||||
id = rs.read String
|
||||
sort_title = rs.read String | Nil
|
||||
@ -391,7 +397,8 @@ class Storage
|
||||
sort_title = nil if sort_title == ""
|
||||
MainFiber.run do
|
||||
get_db do |db|
|
||||
db.exec "update ids set sort_title = (?) where id = (?)", sort_title, entry_id
|
||||
db.exec "update ids set sort_title = (?) where id = (?)",
|
||||
sort_title, entry_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -86,7 +86,7 @@ def env_is_true?(key : String) : Bool
|
||||
val.downcase.in? "1", "true"
|
||||
end
|
||||
|
||||
def sort_titles(titles : Array(Title), opt : SortOptions, username : String) : Array(Title)
|
||||
def sort_titles(titles : Array(Title), opt : SortOptions, username : String)
|
||||
cache_key = SortedTitlesCacheEntry.gen_key username, titles, opt
|
||||
cached_titles = LRUCache.get cache_key
|
||||
return cached_titles if cached_titles.is_a? Array(Title)
|
||||
|
Loading…
x
Reference in New Issue
Block a user