@ -30,13 +30,20 @@ class AboutController < ApplicationController
end
end
defmy_data
defmy_data
@account=current_account
@uid=params[:user_id]
if@uidandcurrent_account.user.admin
@account=Account.find(@uid)
else
@account=current_account
end
year=params[:year].to_i
year=params[:year].to_i
year=nilunlessyear>2000
year=nilunlessyear>2000
@year_text=yearor''
@year_text=yearor''
y=year?"statuses.created_at >= '#{year}-1-1' and statuses.created_at < '#{year+1}-1-1'":nil
y=year?"statuses.created_at >= '#{year}-1-1' and statuses.created_at < '#{year+1}-1-1'":nil
y2=year?"s2.created_at >= '#{year}-1-1' and s2.created_at < '#{year+1}-1-1'":nil
y2=year?"s2.created_at >= '#{year}-1-1' and s2.created_at < '#{year+1}-1-1'":nil
yf=year?"favourites.created_at >='#{year}-1-1' and favourites.created_at < '#{year+1}-1-1'":nil
defraw_to_list(r)
defraw_to_list(r)
@ -46,9 +53,9 @@ class AboutController < ApplicationController
@total=@account.statuses.where(y).count
@total=@account.statuses.where(y).count
@most_times=@account.statuses.where(y).group('cast (created_at as date)').reorder('count_id desc').limit(1).count(:id).map{|k,v|{:date=>k.to_s,:num=>v.to_s}}
@most_times=@account.statuses.where(y).group('cast (created_at as date)').reorder('count_id desc').limit(1).count(:id).map{|k,v|{:date=>k.to_s,:num=>v.to_s}}
@communi_most=raw_to_list(@account.statuses.where(y).where(y2).joins('join statuses as s2 on statuses.account_id != s2.account_id and (statuses.in_reply_to_id = s2.id or s2.in_reply_to_id = statuses.id)').group('s2.account_id').reorder('count_id desc').limit(3).count(:id))
@communi_most=raw_to_list(@account.statuses.where(y).where(y2).joins('join statuses as s2 on statuses.account_id != s2.account_id and (statuses.in_reply_to_id = s2.id or s2.in_reply_to_id = statuses.id)').group('s2.account_id').reorder('count_id desc').limit(5).count(:id))