remove page_views.contributed
An audit of the related code revealed that this column is unused test plan: After running the drop migrations, ensure that page views are still logged correctly and can be viewed via the UI/API/CSV Change-Id: I9141661440513d0c21ec0fdb5f0bd80dbb7c1c55 Reviewed-on: https://gerrit.instructure.com/30743 Reviewed-by: Cody Cutrer <cody@instructure.com> QA-Review: August Thornton <august@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> Product-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
parent
fc02c6a71a
commit
02fba1e3d0
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
# },
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue