Skip to content

Commit

Permalink
[BUG FIX] [MER-4122] Restore superactivity state on instructor review…
Browse files Browse the repository at this point in the history
… of student solution

instructor review

Co-authored-by: Anders Weinstein <[email protected]>
  • Loading branch information
andersweinstein and Anders Weinstein authored Dec 23, 2024
1 parent a523a2b commit e765d09
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/oli_web/controllers/legacy_superactivity_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ defmodule OliWeb.LegacySuperactivityController do
:activity_attempt,
:resource_attempt,
:resource_access,
:attempt_user_id,
:save_files,
:instructors,
:enrollment,
Expand Down Expand Up @@ -116,6 +117,9 @@ defmodule OliWeb.LegacySuperactivityController do

resource_access = Attempts.get_resource_access(resource_attempt.resource_access_id)

# different than current user when instructor reviews student attempt
attempt_user_id = resource_access.user_id

section =
Sections.get_section_preloaded!(resource_access.section_id)
|> Repo.preload([:institution, :section_project_publications])
Expand All @@ -134,7 +138,7 @@ defmodule OliWeb.LegacySuperactivityController do
save_files =
ActivityLifecycle.get_activity_attempt_save_files(
activity_attempt.attempt_guid,
Integer.to_string(user.id),
Integer.to_string(attempt_user_id),
activity_attempt.attempt_number
)

Expand All @@ -147,6 +151,7 @@ defmodule OliWeb.LegacySuperactivityController do
activity_attempt: activity_attempt,
resource_attempt: resource_attempt,
resource_access: resource_access,
attempt_user_id: attempt_user_id,
save_files: save_files,
instructors: instructors,
enrollment: enrollment,
Expand Down Expand Up @@ -338,19 +343,20 @@ defmodule OliWeb.LegacySuperactivityController do

defp process_command(
"loadFileRecord",
%LegacySuperactivityContext{} = _context,
%LegacySuperactivityContext{} = context,
%{
"activityContextGuid" => attempt_guid
} = params
) do
file_name = Map.get(params, "fileName")
attempt_number = Map.get(params, "attemptNumber")
user_id = Map.get(params, "userGuid")
# use attempt_user from context to allow for instructor review of student work
attempt_user_id = context.attempt_user_id

save_file =
ActivityLifecycle.get_activity_attempt_save_file(
attempt_guid,
user_id,
Integer.to_string(attempt_user_id),
attempt_number,
file_name
)
Expand Down

0 comments on commit e765d09

Please sign in to comment.