Permalink
Browse files

optimize get_channel_list_info

  • Loading branch information...
sorah committed Oct 22, 2017
1 parent ba8c5c6 commit ad839acd558f2169237013c768db807ca8d90f01
Showing with 7 additions and 8 deletions.
  1. +7 −8 isubata/webapp/ruby/app.rb
View
@@ -552,15 +552,14 @@ def register(user, password)
end
def get_channel_list_info(focus_channel_id = nil)
channels = db.query('SELECT * FROM channel ORDER BY id').to_a
description = ''
channels.each do |channel|
if channel['id'] == focus_channel_id
description = channel['description']
break
end
@channel_list ||= db.query('SELECT id,name FROM channel ORDER BY id').to_a
if focus_channel_id
statement = db.prepare('SELECT description FROM channel WHERE id = ? LIMIT 1')
description = statement.execute(focus_channel_id.to_i).first['description']
statement.close
end
[channels, description]
[@channel_list , description]
end
def ext2mime(ext)

0 comments on commit ad839ac

Please sign in to comment.