Skip to content

Commit

Permalink
Mod: Unknow fix in server
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Apr 4, 2011
1 parent 19368a3 commit 500a656
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def index
end

def newbie
ask_logs = Log.any_of({:_type => "AskLog"}, {:_type => "UserLog", :action.in => ["FOLLOW_ASK", "UNFOLLOW_ASK"]}).where(:created_at.gte => (Time.now - 1.day))
answer_logs = Log.any_of({:_type => "AnswerLog"}, {:_type => "UserLog", :action => "AGREE"}).where(:created_at.gte => (Time.now - 1.day))
ask_logs = Log.any_of({:_type => "AskLog"}, {:_type => "UserLog", :action.in => ["FOLLOW_ASK", "UNFOLLOW_ASK"]}).where(:created_at.gte => (Time.now - 2.hours))
answer_logs = Log.any_of({:_type => "AnswerLog"}, {:_type => "UserLog", :action => "AGREE"}).where(:created_at.gte => (Time.now - 2.hours))
@asks = Ask.any_of({:_id.in => ask_logs.map {|l| l.target_id}.uniq}, {:_id.in => answer_logs.map {|l| l.target_parent_id}.uniq}).desc("answers_count")
h = {}
@hot_topics = @asks.inject([]) { |memo, ask|
Expand All @@ -33,6 +33,9 @@ def newbie
@hot_topics.delete("者也")
@hot_topics.delete("知乎")
@hot_topics.delete("反馈")
@hot_topics.delete("zheye")
@hot_topics.delete("Quora")
@hot_topics.delete("quora")

@hot_topics.each { |str|
h[str] = (h[str] || 0) + 1
Expand Down
1 change: 0 additions & 1 deletion app/views/logs/_log.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ when "AskLog"
<div class="ask" ask-id="<%= log.id %>">
<%
case action
when "NEW"
%>
<% when "ADD_TOPIC", "DEL_TOPIC","EDIT" %>
<div class="title small_title"><a href="/asks/<%= item.id %>"><%= item.title %></a></div>
Expand Down

0 comments on commit 500a656

Please sign in to comment.