Skip to content

Commit

Permalink
only get the latest attempt for the page if there are multiple attemp…
Browse files Browse the repository at this point in the history
…ts (#4996)
  • Loading branch information
eliknebel authored Aug 1, 2024
1 parent 804ff01 commit 4d2172d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/oli/analytics/xapi.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ defmodule Oli.Analytics.XAPI do
# the context for the video event plus the page_attempt_number and page
# resource_id

# only get the latest attempt for the page if there are multiple attempts
query =
from p in Oli.Delivery.Attempts.Core.ResourceAttempt,
join: a in Oli.Delivery.Attempts.Core.ResourceAccess,
Expand All @@ -88,6 +89,8 @@ defmodule Oli.Analytics.XAPI do
join: sr in Oli.Delivery.Sections.SectionResource,
on: a.resource_id == sr.resource_id and a.section_id == sr.section_id,
where: p.attempt_guid == ^page_attempt_guid,
order_by: [desc: p.attempt_number],
limit: 1,
select:
{p.attempt_number, a.resource_id, a.section_id, a.user_id, sr.project_id,
spp.publication_id}
Expand Down

0 comments on commit 4d2172d

Please sign in to comment.