Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First implementation of widgets using jquery-ui
- Loading branch information
Showing
475 changed files
with
61,986 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,143 @@ | ||
class ProjectsController < ApplicationController | ||
before_filter :authorize | ||
layout "projects", :except => [ :overview, :visitors,:referrers] | ||
|
||
|
||
|
||
|
||
|
||
def index | ||
redirect_to project_overview_url :id=>session[:project_id] | ||
|
||
@project = Project.find(session[:project_id]) | ||
p = @project | ||
bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S") | ||
eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S") | ||
|
||
conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"] | ||
|
||
vs = p.visitors.find(:all,:conditions=>conditions) | ||
@total_clicks = p.total_clicks(vs) | ||
|
||
@nvisits = vs.size | ||
@page_views =p.page_views(vs) | ||
if @page_views == 0 | ||
@avg_pageviews = 0 | ||
else | ||
@avg_pageviews = "%.2f" % ((@page_views+0.0)/@nvisits) | ||
end | ||
|
||
@time_on_site = p.time_on_site(vs) | ||
@bounce_rate = "%.2f" % (p.bounce_rate(vs) * 100) | ||
@new_visits = "%.2f" % (p.new_visits(vs) * 100) | ||
@data_website = p.website_list(vs).first(10) | ||
|
||
|
||
|
||
end | ||
|
||
def overview | ||
if session[:project_id] == nil | ||
@project = nil | ||
else | ||
@project = Project.find(session[:project_id]) | ||
end | ||
# def overview | ||
# | ||
# redirect_to :action =>"index" | ||
# # if session[:project_id] == nil | ||
# # @project = nil | ||
# # else | ||
# # @project = Project.find(session[:project_id]) | ||
# # p = @project | ||
# # bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S") | ||
# # eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S") | ||
# # | ||
# # conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"] | ||
# # | ||
# # vs = p.visitors.find(:all,:conditions=>conditions) | ||
# # @total_clicks = p.total_clicks(vs) | ||
# # | ||
# # @nvisits = vs.size | ||
# # @page_views = p.page_views(vs) | ||
# # | ||
# # if @page_views == 0 | ||
# # @avg_pageviews = 0 | ||
# # else | ||
# # @avg_pageviews = "%.2f" % ((@page_views+0.0)/@nvisits) | ||
# # end | ||
# # | ||
# # @time_on_site = p.time_on_site(vs) | ||
# # @bounce_rate = "%.2f" % (p.bounce_rate(vs) * 100) | ||
# # @new_visits = "%.2f" % (p.new_visits(vs) * 100) | ||
# # | ||
# # @data_website = p.website_list(vs) | ||
# # | ||
# # | ||
# # end | ||
# end | ||
def referrers | ||
p = Project.find(session[:project_id]) | ||
@project = p | ||
bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S") | ||
eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S") | ||
|
||
conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"] | ||
|
||
vs = p.visitors.find(:all,:conditions=>conditions) | ||
@data_website = p.website_list(vs) | ||
@searched_keywords = p.search_engine_queries(vs) | ||
|
||
|
||
|
||
end | ||
def visitors | ||
p = Project.find(session[:project_id]) | ||
@project = p | ||
bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S") | ||
eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S") | ||
|
||
conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"] | ||
|
||
vs = p.visitors.find(:all,:conditions=>conditions) | ||
|
||
|
||
|
||
@config_os = p.config_os(vs) | ||
@browsers = p.browsers(vs) | ||
#@hours_by_servertime = p.hours_by_servertime(vs) | ||
@config_resolution = p.config_resolution(vs).first(5) | ||
|
||
|
||
|
||
end | ||
|
||
def prova | ||
p = Project.find(session[:project_id]) | ||
|
||
@project = p | ||
bod = Time.parse("2009-01-01").strftime("%Y-%m-%d %H:%M:%S") | ||
eod = Time.now.end_of_day.strftime("%Y-%m-%d %H:%M:%S") | ||
|
||
conditions = ["created_at > ? AND created_at < ?", "#{bod}", "#{eod}"] | ||
|
||
vs = p.visitors.find(:all,:conditions=>conditions) | ||
|
||
|
||
|
||
@total_clicks = p.total_clicks(vs) | ||
@config_os = p.config_os(vs) | ||
@browsers = p.browsers(vs) | ||
@actions = p.visitors_per_action | ||
@search_engines = p.search_engines(vs) | ||
@time_spent = p.time_spent(vs) | ||
@hours_by_servertime = p.hours_by_servertime(vs) | ||
@traffic_sources = p.traffic_sources(vs) | ||
|
||
|
||
@data = p.search_engine_queries(vs) | ||
@data_website = p.website_list(vs) | ||
|
||
|
||
@nvisits = vs.size | ||
@page_views = p.page_views(vs) | ||
@avg_pageviews = "%.2f" % ((@page_views+0.0)/@nvisits) | ||
@time_on_site = p.time_on_site(vs) | ||
@bounce_rate = "%.2f" % (p.bounce_rate(vs) * 100) | ||
@new_visits = "%.2f" % (p.new_visits(vs) * 100) | ||
|
||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.