diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index da6fdc734eb..41d6f42a477 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -786,7 +786,7 @@ class ApplicationController < ActionController::Base return true if !page_views_enabled? if @current_user && @log_page_views != false - updated_fields = params.slice(:interaction_seconds, :page_view_contributed) + updated_fields = params.slice(:interaction_seconds) if request.xhr? && params[:page_view_id] && !updated_fields.empty? && !(@page_view && @page_view.generated_by_hand) @page_view = PageView.find_for_update(params[:page_view_id]) if @page_view diff --git a/app/controllers/page_views_controller.rb b/app/controllers/page_views_controller.rb index 9c5bad0aa4a..8c20d6f3f98 100644 --- a/app/controllers/page_views_controller.rb +++ b/app/controllers/page_views_controller.rb @@ -57,7 +57,7 @@ # "type": "string" # }, # "contributed": { -# "description": "True if the request counted as contributing, such as editing a wiki page", +# "description": "This field is deprecated, and will always be false", # "example": "false", # "type": "boolean" # }, diff --git a/app/models/page_view.rb b/app/models/page_view.rb index fba9b5950a4..9f04a692f19 100644 --- a/app/models/page_view.rb +++ b/app/models/page_view.rb @@ -92,7 +92,7 @@ class PageView < ActiveRecord::Base end # the list of columns we display to users, export to csv, etc - EXPORTED_COLUMNS = %w(request_id user_id url context_id context_type asset_id asset_type controller action contributed interaction_seconds created_at user_request render_time user_agent participated account_id real_user_id http_method remote_ip) + EXPORTED_COLUMNS = %w(request_id user_id url context_id context_type asset_id asset_type controller action interaction_seconds created_at user_request render_time user_agent participated account_id real_user_id http_method remote_ip) def self.page_views_enabled? !!page_view_method @@ -260,7 +260,6 @@ class PageView < ActiveRecord::Base shard.activate do updated_at = params['updated_at'] || self.updated_at || Time.now updated_at = Time.parse(updated_at) if updated_at.is_a?(String) - self.contributed ||= params['page_view_contributed'] || params['contributed'] seconds = self.interaction_seconds || 0 if params['interaction_seconds'].to_i > 0 seconds += params['interaction_seconds'].to_i diff --git a/config/initializers/dropped_columns.rb b/config/initializers/dropped_columns.rb index cc7406a3bed..1a6a192d031 100644 --- a/config/initializers/dropped_columns.rb +++ b/config/initializers/dropped_columns.rb @@ -36,6 +36,7 @@ class ActiveRecord::Base 'enrollments' => %w(invitation_email can_participate_before_start_at limit_priveleges_to_course_sections), 'groups' => %w(sis_name type groupable_id groupable_type), 'notification_policies' => %w(user_id), + 'page_views' => %w(contributed), 'pseudonyms' => %w(sis_update_data deleted_unique_id sis_source_id crypted_webdav_access_code type), 'role_overrides' => %w(context_code), 'users' => %w(type creation_unique_id creation_sis_batch_id creation_email sis_name bio), diff --git a/db/migrate/20140224212704_remove_page_views_contributed.rb b/db/migrate/20140224212704_remove_page_views_contributed.rb new file mode 100644 index 00000000000..0346a351472 --- /dev/null +++ b/db/migrate/20140224212704_remove_page_views_contributed.rb @@ -0,0 +1,11 @@ +class RemovePageViewsContributed < ActiveRecord::Migration + tag :postdeploy + + def self.up + remove_column :page_views, :contributed + end + + def self.down + add_column :page_views, :contributed, :boolean + end +end diff --git a/db/migrate/20140224212705_remove_cassandra_page_views_contributed.rb b/db/migrate/20140224212705_remove_cassandra_page_views_contributed.rb new file mode 100644 index 00000000000..390a7e68361 --- /dev/null +++ b/db/migrate/20140224212705_remove_cassandra_page_views_contributed.rb @@ -0,0 +1,17 @@ +class RemoveCassandraPageViewsContributed < ActiveRecord::Migration + tag :postdeploy + + include Canvas::Cassandra::Migration + + def self.cassandra_cluster + 'page_views' + end + + def self.up + cassandra.execute %{ ALTER TABLE page_views DROP contributed; } + end + + def self.down + cassandra.execute %{ ALTER TABLE page_views ADD contributed boolean; } + end +end diff --git a/lib/api/v1/page_view.rb b/lib/api/v1/page_view.rb index 96174f326cd..f7d49821369 100644 --- a/lib/api/v1/page_view.rb +++ b/lib/api/v1/page_view.rb @@ -30,6 +30,7 @@ module Api::V1::PageView def page_view_json(page_view, current_user, session) json_hash = api_json(page_view, current_user, session, API_PAGE_VIEW_JSON_OPTS) json_hash[:id] = json_hash.delete(:request_id) + json_hash[:contributed] = false # for backwards compatibility json_hash[:links] = { :user => json_hash.delete(:user_id), :context => json_hash.delete(:context_id), diff --git a/public/javascripts/page_views.js b/public/javascripts/page_views.js index d079218a3c0..69f7de24f23 100644 --- a/public/javascripts/page_views.js +++ b/public/javascripts/page_views.js @@ -55,9 +55,6 @@ define([ }); $(document).bind('page_view_update', function(event, force) { var data = {}; - if($page_view_id.hasClass('contributed')) { - data.contributed = true; - } if(force || (interactionSeconds > 10 && secondsSinceLastEvent < intervalInSeconds)) { data.interaction_seconds = interactionSeconds; diff --git a/spec/lib/api/v1/page_view_spec.rb b/spec/lib/api/v1/page_view_spec.rb index 6114e3f111e..f1e566dd9ff 100644 --- a/spec/lib/api/v1/page_view_spec.rb +++ b/spec/lib/api/v1/page_view_spec.rb @@ -48,7 +48,6 @@ describe Api::V1::PageView do :participated => false, :user_request => true, :interaction_seconds => 7.21, - :contributed => false, :action => "index", :controller => "controller", :account_id => @domain_root_account.id @@ -76,7 +75,7 @@ describe Api::V1::PageView do page_view[:participated].should == @page_view.participated page_view[:user_request].should == @page_view.user_request page_view[:interaction_seconds].should == @page_view.interaction_seconds - page_view[:contributed].should == @page_view.contributed + page_view[:contributed].should == false page_view[:action].should == @page_view.action page_view[:controller].should == @page_view.controller