create a page_view on a participation
fixes: CNVS-12029 This consolidates the use of log_asset_access so when this is set as a participation and a page_view does not exist it will create one. This will keep the asset user access in sync for participations so analytics and the access reports are not off. Test Plan: Create a course with some quizes. Take the quiz and view the quiz to generate some activity for a student. Open the Student Activity report along with analytics for the student/course. Make sure the numbers of participations match in each report. Change-Id: If8b6e7d86e350d5b2a3dd15ca9236c14f52d300a Reviewed-on: https://gerrit.instructure.com/32382 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Brian Palmer <brianp@instructure.com> QA-Review: August Thornton <august@instructure.com> Product-Review: Nick Cloward <ncloward@instructure.com>
This commit is contained in:
parent
f1009a38fe
commit
398ac0996d
|
@ -822,6 +822,10 @@ class ApplicationController < ActionController::Base
|
|||
access_context = @context.is_a?(UserProfile) ? @context.user : @context
|
||||
@access.log access_context, @accessed_asset
|
||||
|
||||
if @page_view.nil? && page_views_enabled? && %w{participate submit}.include?(@accessed_asset[:level])
|
||||
generate_page_view
|
||||
end
|
||||
|
||||
if @page_view
|
||||
@page_view.participated = %w{participate submit}.include?(@accessed_asset[:level])
|
||||
@page_view.asset_user_access = @access
|
||||
|
|
|
@ -427,7 +427,6 @@ class AssignmentsController < ApplicationController
|
|||
@assignment.assignment_group = group if group
|
||||
if @assignment.update_attributes(params[:assignment])
|
||||
log_asset_access(@assignment, "assignments", @assignment_group, 'participate')
|
||||
generate_new_page_view
|
||||
@assignment.context_module_action(@current_user, :contributed)
|
||||
@assignment.reload
|
||||
flash[:notice] = t 'notices.updated', "Assignment was successfully updated."
|
||||
|
|
|
@ -264,7 +264,6 @@ class ConferencesController < ApplicationController
|
|||
@conference.add_attendee(@current_user)
|
||||
@conference.restart if @conference.ended_at && @conference.grants_right?(@current_user, session, :initiate)
|
||||
log_asset_access(@conference, "conferences", "conferences", 'participate')
|
||||
generate_new_page_view
|
||||
if url = @conference.craft_url(@current_user, session, named_context_url(@context, :context_url, :include_host => true))
|
||||
redirect_to url
|
||||
else
|
||||
|
|
|
@ -539,7 +539,6 @@ class DiscussionTopicsApiController < ApplicationController
|
|||
if @entry.save
|
||||
@entry.update_topic
|
||||
log_asset_access(@topic, 'topics', 'topics', 'participate')
|
||||
generate_new_page_view
|
||||
@entry.context_module_action
|
||||
if has_attachment
|
||||
@attachment = (@current_user || @context).attachments.create(:uploaded_data => params[:attachment])
|
||||
|
|
|
@ -683,7 +683,6 @@ class DiscussionTopicsController < ApplicationController
|
|||
end
|
||||
if !@topic.errors.any? && !@topic.root_topic.try(:errors).try(:any?)
|
||||
log_asset_access(@topic, 'topics', 'topics', 'participate')
|
||||
generate_new_page_view
|
||||
|
||||
apply_positioning_parameters
|
||||
apply_attachment_parameters
|
||||
|
|
|
@ -422,7 +422,6 @@ class FilesController < ApplicationController
|
|||
# a user views an inline preview of a file instead of downloading
|
||||
# it, since this should also count as an access.
|
||||
elsif params[:inline]
|
||||
generate_new_page_view
|
||||
@attachment.context_module_action(@current_user, :read) if @current_user
|
||||
log_asset_access(@attachment, 'files', 'files')
|
||||
@attachment.record_inline_view
|
||||
|
|
|
@ -473,7 +473,6 @@ class SubmissionsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if @submission.save
|
||||
log_asset_access(@assignment, "assignments", @assignment_group, 'submit')
|
||||
generate_new_page_view
|
||||
format.html {
|
||||
flash[:notice] = t('assignment_submit_success', 'Assignment successfully submitted.')
|
||||
redirect_to course_assignment_url(@context, @assignment)
|
||||
|
|
|
@ -120,7 +120,6 @@ class WikiPagesController < ApplicationController
|
|||
end
|
||||
|
||||
log_asset_access(@page, "wiki", @wiki, 'participate')
|
||||
generate_new_page_view
|
||||
@page.context_module_action(@current_user, @context, :contributed)
|
||||
flash[:notice] = t('notices.page_updated', 'Page was successfully updated.')
|
||||
respond_to do |format|
|
||||
|
|
Loading…
Reference in New Issue