Skip to content

Commit

Permalink
[CHORE] [MER-3606] Integration v0.28.2 (#5013)
Browse files Browse the repository at this point in the history
* [BUG FIX] [MER-3423] Using keyboard shortcut (ctrl-del) to delete after a component has been copied causes issues (#4955)

* MER-3423

* More changes

* More Changes

* trying to re-run checks

* Update EditingCanvas.tsx

* [MER-3393]  Add grace period and fix some issues

* [MER-3393]  Changes from review

* disable likert viz

* async project export

* do not include timestamp in filename to prevent unnecessary S3 usage

* fix tests

* fix cyclical dependency issue
fix button padding

* fix warnings

* fix flaky test

* dial up assert_receive time

* add direct delivery research consent form setting

* add research consent link, update form and logic to handle different scenarios

* fix warnings

* fix tests

* flaky test

* [BUG FIX] [MER-3010] fixes sparse likert and multiple attempts (#4966)

Co-authored-by: Raphael Gachuhi <rgachuhi@cmu.edu>

* [BUG FIX] [MER-3516] 500 error when-re-accessing a manually graded assessment (#4971)

* handle attempt submitted state for manually graded activities

* fix test

* [BUG FIX] [MER-3506] After completing a lesson the back arrow does not work (#4979)

* MER-3506 Fix back link

* MER-3506 Add test

* MER-3506 Make more robust SetRequestPath plug

* [BUG FIX] [MER-3548] Change default analytic_version value to v2 for Section and Project (#4991)

* [BUG FIX] [MER-3548] Change default analytic_version value to v2 for section and project

* [BUG FIX] [MER-3548] Add a new test and adjust existing tests

* [BUG FIX] [MER-3553] Lesson end date formatting breaks ability to load Home screen (#4992)

* handle case when days_difference datetime cannot be localized

* fix flaky test

* [BUG FIX] [MER-3557] Not authorized message displayed to student on LTI launch (#4994)

* remove institution_instructor role from list of allow_configure_section_roles

* skip flaky test

* bump version number

* [FEATURE] [MER-3550] Hide agenda home screen (#4993)

* [MER-3550] Adds agenda flag field to section

* [MER-3550] Adds button to toggle agenda field value

* [MER-3550] Renders agenda component conditionally

* [MER-3550] Adds tests

* only get the latest attempt for the page if there are multiple attempts (#4996)

* [BUG FIX] [MER-3565] 500 error when launching assessments from a page link (#5003)

* [MER-3565] Fix page link error on activity rendering

* [MER-3565] Fix page link error on page rendering

* [MER-3565] Add missing props

* [MER-3565] Fix typescript tests

* [MER-3565] Update docker compose command in CI test runner

* fix quiz scores query (#5004)

* [BUG FIX] [MER-3566] remove grade pass back optimization to filter out students that are no longer enrolled in the LMS course (#5006)

* do not show 'Save' paywall settings button for non admin users

* create SetPaywallSummary live session plug

* add SetPaywallSummary plug to routes

* add pay early message to delivery layouts

* remove IO.inspect

* add tests

* improve stub current time for testing

* remove commented test

* bump version number

* [BUG FIX] [MER-3573] torus learning proficiency algorithm leads to undesired results (#5007)

* return not enough data if num first attempts is less than 3

* use sum to aggregate num first attempts

* fixes explanation strategy ui bug (#5010)

Co-authored-by: Raphael Gachuhi <rgachuhi@cmu.edu>

* fix mix deps

---------

Co-authored-by: Devesh Tiwari <70621864+dtiwarATS@users.noreply.github.com>
Co-authored-by: Santiago Simoncelli <simoncellisantiago@gmail.com>
Co-authored-by: Darren Siegel <siegel.darren@gmail.com>
Co-authored-by: Raphael <rgachuhi@users.noreply.github.com>
Co-authored-by: Raphael Gachuhi <rgachuhi@cmu.edu>
Co-authored-by: Francisco-Castro <47334502+Francisco-Castro@users.noreply.github.com>
Co-authored-by: Gastón Abellá <gaston@wyeworks.com>
Co-authored-by: Nicolás Cirio <nicolas.cirio@wyeworks.com>
  • Loading branch information
9 people authored Aug 15, 2024
1 parent 2803b97 commit 2f24f79
Show file tree
Hide file tree
Showing 55 changed files with 654 additions and 193 deletions.
1 change: 1 addition & 0 deletions assets/src/components/activities/DeliveryElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface ActivityContext {
renderPointMarkers: boolean;
isAnnotationLevel: boolean;
variables: any;
pageLinkParams: any;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const DeliveryElementProvider: React.FC<DeliveryElementProps<any>> = (pro
resourceAttemptGuid: props.context.pageAttemptGuid,
renderPointMarkers: props.context.renderPointMarkers,
isAnnotationLevel: props.context.isAnnotationLevel,
pageLinkParams: props.context.pageLinkParams,
});

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const MockDiscussionDeliveryProvider: React.FC<{
renderPointMarkers: false,
isAnnotationLevel: false,
variables: {},
pageLinkParams: {},
}}
onSaveActivity={nullHandler}
onSavePart={nullHandler}
Expand Down
1 change: 1 addition & 0 deletions assets/src/data/content/writers/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface WriterContext {
};
renderPointMarkers?: boolean;
isAnnotationLevel?: boolean;
pageLinkParams?: any;
}

export const defaultWriterContext = (params: Partial<WriterContext> = {}): WriterContext =>
Expand Down
5 changes: 4 additions & 1 deletion assets/src/data/content/writers/html.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,10 @@ export class HtmlParser implements WriterImpl {
let internalHref = href;
if (context.sectionSlug) {
const revisionSlug = href.replace(/^\/course\/link\//, '');
internalHref = `/sections/${context.sectionSlug}/page/${revisionSlug}`;
const params = new URLSearchParams(context.pageLinkParams);
const queryString = params.toString();

internalHref = `/sections/${context.sectionSlug}/lesson/${revisionSlug}?${queryString}`;
} else {
internalHref = '#';
}
Expand Down
1 change: 1 addition & 0 deletions assets/test/check_all_that_apply/cata_delivery_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('check all that apply delivery', () => {
renderPointMarkers: false,
isAnnotationLevel: false,
variables: {},
pageLinkParams: {},
},
preview: false,
};
Expand Down
1 change: 1 addition & 0 deletions assets/test/multiple_choice/mc_delivery_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('multiple choice delivery', () => {
renderPointMarkers: false,
isAnnotationLevel: false,
variables: {},
pageLinkParams: {},
},
graded: false,
preview: false,
Expand Down
1 change: 1 addition & 0 deletions assets/test/ordering/ordering_delivery_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('ordering delivery', () => {
renderPointMarkers: false,
isAnnotationLevel: false,
variables: {},
pageLinkParams: {},
},
preview: false,
};
Expand Down
1 change: 1 addition & 0 deletions assets/test/short_answer/short_answer_delivery_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('multiple choice delivery', () => {
renderPointMarkers: false,
isAnnotationLevel: false,
variables: {},
pageLinkParams: {},
},
preview: false,
};
Expand Down
15 changes: 13 additions & 2 deletions assets/test/writer/writer_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,23 @@ describe('parser', () => {
});

it('renders internal link with context', () => {
render(parse(exampleContent, defaultWriterContext({ sectionSlug: 'some_section' })));
render(
parse(
exampleContent,
defaultWriterContext({
sectionSlug: 'some_section',
pageLinkParams: {
request_path: '/path/to/previous/page',
},
}),
),
);
expect(
screen.getByText((content, element) => {
return (
element?.tagName.toLowerCase() === 'a' &&
element.getAttribute('href') === '/sections/some_section/page/page_two' &&
element.getAttribute('href') ===
'/sections/some_section/lesson/page_two?request_path=%2Fpath%2Fto%2Fprevious%2Fpage' &&
content === 'Page Two'
);
}),
Expand Down
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
2 changes: 1 addition & 1 deletion lib/oli/authoring/course/project.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ defmodule Oli.Authoring.Course.Project do
field(:latest_analytics_snapshot_timestamp, :utc_datetime)
field(:latest_datashop_snapshot_url, :string)
field(:latest_datashop_snapshot_timestamp, :utc_datetime)
field(:analytics_version, Ecto.Enum, values: [:v1, :v2], default: :v1)
field(:analytics_version, Ecto.Enum, values: [:v1, :v2], default: :v2)
field(:allow_transfer_payment_codes, :boolean, default: false)
field(:welcome_title, :map, default: %{})

Expand Down
64 changes: 33 additions & 31 deletions lib/oli/delivery/metrics.ex
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ defmodule Oli.Delivery.Metrics do
end)
end

defp aggregate_raw_proficiency([]), do: proficiency_range(nil)
defp aggregate_raw_proficiency([]), do: proficiency_range(nil, 0)

defp aggregate_raw_proficiency(raw_values) do
{total_correct, total_count} =
Expand All @@ -728,7 +728,7 @@ defmodule Oli.Delivery.Metrics do

proficiency_value = if total_count == 0, do: 0, else: total_correct / total_count

proficiency_range(proficiency_value)
proficiency_range(proficiency_value, total_count)
end

def raw_proficiency_per_learning_objective(%Section{analytics_version: :v1, slug: section_slug}) do
Expand Down Expand Up @@ -945,12 +945,12 @@ defmodule Oli.Delivery.Metrics do
fragment(
"CAST(COUNT(CASE WHEN ? THEN 1 END) as float) / CAST(COUNT(*) as float)",
sn.correct
)}
), fragment("CAST(COUNT(*) as float)")}
)

Repo.all(query)
|> Enum.into(%{}, fn {student_id, proficiency} ->
{student_id, proficiency_range(proficiency)}
|> Enum.into(%{}, fn {student_id, proficiency, num_first_attempts} ->
{student_id, proficiency_range(proficiency, num_first_attempts)}
end)
end

Expand Down Expand Up @@ -992,12 +992,12 @@ defmodule Oli.Delivery.Metrics do
"CAST(SUM(?) as float) / NULLIF(CAST(SUM(?) as float), 0.0)",
summary.num_first_attempts_correct,
summary.num_first_attempts
)}
), sum(summary.num_first_attempts)}
)

Repo.all(query)
|> Enum.into(%{}, fn {student_id, proficiency} ->
{student_id, proficiency_range(proficiency)}
|> Enum.into(%{}, fn {student_id, proficiency, num_first_attempts} ->
{student_id, proficiency_range(proficiency, num_first_attempts)}
end)
end

Expand Down Expand Up @@ -1088,12 +1088,12 @@ defmodule Oli.Delivery.Metrics do
fragment(
"CAST(COUNT(CASE WHEN ? THEN 1 END) as float) / CAST(COUNT(*) as float)",
sn.correct
)}
), fragment("CAST(COUNT(*) as float)")}
)

Repo.all(query)
|> Enum.into(%{}, fn {resource_id, proficiency} ->
{resource_id, proficiency_range(proficiency)}
|> Enum.into(%{}, fn {resource_id, proficiency, num_first_attempts} ->
{resource_id, proficiency_range(proficiency, num_first_attempts)}
end)
end

Expand All @@ -1117,13 +1117,14 @@ defmodule Oli.Delivery.Metrics do
"CAST(? as float) / NULLIF(CAST(? as float), 0.0)",
summary.num_first_attempts_correct,
summary.num_first_attempts
)
),
summary.num_first_attempts
}
)

Repo.all(query)
|> Enum.into(%{}, fn {resource_id, proficiency} ->
{resource_id, proficiency_range(proficiency)}
|> Enum.into(%{}, fn {resource_id, proficiency, num_first_attempts} ->
{resource_id, proficiency_range(proficiency, num_first_attempts)}
end)
end

Expand Down Expand Up @@ -1155,12 +1156,12 @@ defmodule Oli.Delivery.Metrics do
fragment(
"CAST(COUNT(CASE WHEN ? THEN 1 END) as float) / CAST(COUNT(*) as float)",
sn.correct
)}
), fragment("CAST(COUNT(*) as float)")}
)

Repo.all(query)
|> Enum.into(%{}, fn {student_id, proficiency} ->
{student_id, proficiency_range(proficiency)}
|> Enum.into(%{}, fn {student_id, proficiency, num_first_attempts} ->
{student_id, proficiency_range(proficiency, num_first_attempts)}
end)
end

Expand All @@ -1182,12 +1183,12 @@ defmodule Oli.Delivery.Metrics do
"CAST(? as float) / NULLIF(CAST(? as float), 0.0)",
summary.num_first_attempts_correct,
summary.num_first_attempts
)}
), summary.num_first_attempts}
)

Repo.all(query)
|> Enum.into(%{}, fn {student_id, proficiency} ->
{student_id, proficiency_range(proficiency)}
|> Enum.into(%{}, fn {student_id, proficiency, num_first_attempts} ->
{student_id, proficiency_range(proficiency, num_first_attempts)}
end)
end

Expand Down Expand Up @@ -1216,12 +1217,12 @@ defmodule Oli.Delivery.Metrics do
fragment(
"CAST(COUNT(CASE WHEN ? THEN 1 END) as float) / CAST(COUNT(*) as float)",
sn.correct
)}
), fragment("CAST(COUNT(*) as float)")}
)

Repo.all(query)
|> Enum.into(%{}, fn {page_id, proficiency} ->
{page_id, proficiency_range(proficiency)}
|> Enum.into(%{}, fn {page_id, proficiency, num_first_attempts} ->
{page_id, proficiency_range(proficiency, num_first_attempts)}
end)
end

Expand All @@ -1243,19 +1244,20 @@ defmodule Oli.Delivery.Metrics do
"? / NULLIF(?, 0)",
summary.num_first_attempts_correct,
summary.num_first_attempts
)}
), summary.num_first_attempts}
)

Repo.all(query)
|> Enum.into(%{}, fn {page_id, proficiency} ->
{page_id, proficiency_range(proficiency)}
|> Enum.into(%{}, fn {page_id, proficiency, num_first_attempts} ->
{page_id, proficiency_range(proficiency, num_first_attempts)}
end)
end

def proficiency_range(nil), do: "Not enough data"
def proficiency_range(proficiency) when proficiency <= 0.5, do: "Low"
def proficiency_range(proficiency) when proficiency <= 0.8, do: "Medium"
def proficiency_range(_proficiency), do: "High"
def proficiency_range(_, num_first_attempts) when num_first_attempts < 3, do: "Not enough data"
def proficiency_range(nil, _num_first_attempts), do: "Not enough data"
def proficiency_range(proficiency, _num_first_attempts) when proficiency <= 0.5, do: "Low"
def proficiency_range(proficiency, _num_first_attempts) when proficiency <= 0.8, do: "Medium"
def proficiency_range(_proficiency, _num_first_attempts), do: "High"

def progress_range(nil), do: "Not enough data"
def progress_range(progress) when progress <= 0.5, do: "Low"
Expand Down Expand Up @@ -1432,7 +1434,7 @@ defmodule Oli.Delivery.Metrics do
_ -> correct / total
end

{container_id, proficiency_range(proficiency)}
{container_id, proficiency_range(proficiency, total)}
end)
end

Expand Down
17 changes: 10 additions & 7 deletions lib/oli/delivery/paywall.ex
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ defmodule Oli.Delivery.Paywall do
false

_ ->
case Date.compare(Date.utc_today(), Date.add(start_date, days)) do
case Date.compare(Oli.Date.utc_today(), Date.add(start_date, days)) do
:lt -> true
:eq -> true
_ -> false
end
end

:relative_to_student ->
Date.compare(Date.utc_today(), Date.add(inserted_at, days)) == :lt
Date.compare(Oli.Date.utc_today(), Date.add(inserted_at, days)) == :lt
end
end

Expand All @@ -157,12 +157,15 @@ defmodule Oli.Delivery.Paywall do
case strategy do
:relative_to_section ->
case start_date do
nil -> 0
_ -> -DateTime.diff(DateTime.utc_now(), DateTime.add(start_date, days * 24 * 60 * 60))
nil ->
0

_ ->
-DateTime.diff(Oli.DateTime.utc_now(), DateTime.add(start_date, days * 24 * 60 * 60))
end

:relative_to_student ->
-DateTime.diff(DateTime.utc_now(), DateTime.add(inserted_at, days * 24 * 60 * 60))
-DateTime.diff(Oli.DateTime.utc_now(), DateTime.add(inserted_at, days * 24 * 60 * 60))
end
end

Expand Down Expand Up @@ -195,7 +198,7 @@ defmodule Oli.Delivery.Paywall do
end

defp create_codes_for_section(%Section{id: id, amount: amount}, number_of_codes) do
now = DateTime.utc_now()
now = Oli.DateTime.utc_now()

Repo.transaction(fn _ ->
case unique_codes(number_of_codes) do
Expand Down Expand Up @@ -368,7 +371,7 @@ defmodule Oli.Delivery.Paywall do
enrollment_id: id,
pending_user_id: user.id,
pending_section_id: section.id,
application_date: DateTime.utc_now()
application_date: Oli.DateTime.utc_now()
})

_ ->
Expand Down
7 changes: 4 additions & 3 deletions lib/oli/delivery/sections.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4709,7 +4709,7 @@ defmodule Oli.Delivery.Sections do
Map.merge(objective, %{
objective: objective.title,
objective_resource_id: objective.resource_id,
student_proficiency_obj: calc.(correct, total) |> Metrics.proficiency_range(),
student_proficiency_obj: Metrics.proficiency_range(calc.(correct, total), total),
subobjective: "",
subobjective_resource_id: nil,
student_proficiency_subobj: ""
Expand All @@ -4729,10 +4729,11 @@ defmodule Oli.Delivery.Sections do
objective: objective.title,
objective_resource_id: objective.resource_id,
student_proficiency_obj:
calc.(parent_correct, parent_total) |> Metrics.proficiency_range(),
Metrics.proficiency_range(calc.(parent_correct, parent_total), parent_total),
subobjective: sub_objective.title,
subobjective_resource_id: sub_objective.resource_id,
student_proficiency_subobj: calc.(correct, total) |> Metrics.proficiency_range()
student_proficiency_subobj:
Metrics.proficiency_range(calc.(correct, total), total)
})
end)

Expand Down
Loading

0 comments on commit 2f24f79

Please sign in to comment.