Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX][MER-2570] Fix error accessing project preview #4244

Conversation

simonchoxx
Copy link
Contributor

@simonchoxx simonchoxx commented Sep 25, 2023

MER-2570

Fixed a couple of bugs when rendering the project preview.

  • Error when calling DeliveryResolver instead of calling AuthoringResolver. This was failing when you have one selection criteria for an activity bank by objective and there is no objective added in the activity banks.

  • Error when applying a selection criteria by item type and there is no such activity in the activity bank.

@@ -94,7 +94,7 @@ defmodule Oli.Rendering.Content.Selection do
%{}

ids ->
Oli.Publishing.DeliveryResolver.from_resource_id(section_slug, ids)
Oli.Publishing.AuthoringResolver.from_resource_id(section_slug, ids)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I'm understanding this change. The DeliveryResolver function expects a section slug while the AuthoringResolver one expects a project slug, so why are we switching functions here?

@simonchoxx simonchoxx force-pushed the bugfix/MER-2570-fix-error-accessing-project-preview branch from 3253562 to 854c717 Compare September 25, 2023 18:15
@nicocirio nicocirio changed the base branch from v25-rc to prerelease-v0.25.0 September 26, 2023 19:13
@@ -94,7 +94,15 @@ defmodule Oli.Rendering.Content.Selection do
%{}

ids ->
Oli.Publishing.DeliveryResolver.from_resource_id(section_slug, ids)
revisions =
if Enum.any?(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This selection renderer is unique - as it only ever gets called during page preview. In normal delivery, by the time we get to rendering the activity bank selections have been "fulfilled" and have been replaced by actual activities. For page preview, we do not fulfill bank selections, we instead leave them in the page model and this rendering code provides a summary of them to the author. So that being said, we never want to use the DeliveryResolver in this code, we only want to resolve to the Authoring revisions.

I suspect the use of DeliveryResolver was the problem and what was yielding the nil ids. I think we should simplify this code to:

 Oli.Publishing.AuthoringResolver.from_resource_id(section_slug, ids). # This section_slug really is the project slug
|> Enum.filter(fn r -> !is_nil(r) end)
|> Enum.reduce(%{}, fn rev, m -> Map.put(m, rev.resource_id, rev.title) end)

@darrensiegel darrensiegel merged commit 9ea6a87 into prerelease-v0.25.0 Oct 3, 2023
@darrensiegel darrensiegel deleted the bugfix/MER-2570-fix-error-accessing-project-preview branch October 3, 2023 18:07
eliknebel added a commit that referenced this pull request Oct 5, 2023
* [BUGFIX][MER-2565] Fix user's full name length

* [MER-2587][BUGFIX] Flashing option dropdown (#4248)

* fix option dropdown flashing by implementing JS commands instead of bs-toogle

* fix tests

* [MER-2566] Fixes modal onmount error (#4247)

* [MER-2298] Adds sort by published date (#4249)

* [BUG FIX][MER-2613] floating titlebar z index bounds and sticky messages (#4261)

* rework title bar so that it doesnt cover other components

* fix duplicate sticky banners

* [Enhancement] Better link, callout, foreign editing [MER-2469] [MER-2409] (#4258)

* [Enhancement] Link editing improvements

* Generalized our empty-link removal to other types

* Auto format

---------

Co-authored-by: marc-hughes <[email protected]>

* [Enhancement] Changed error message wording on admin adaptive preview (#4257)

* [BUGFIX][MER-2410] New Institution not being created after approving registration (#4256)

* approve registration when setting  dropdown option

* add tests

* fix Cancel button for review-registration-modal and decline-registration-modal

* refetch institutions after approval

* [Bugfix] Render bar between dates correctly (#4260)

* [Bugfix] Visual connector bar on scheduler works on small date ranges

* [Bugfix] Fixed dragging icon on last day of 31 day month

* Auto format

---------

Co-authored-by: marc-hughes <[email protected]>

* [BUG FIX] fix cardinality assumption in Accounts.is_lms_user?/1 [MER-2576] (#4262)

* fix cardinality assumption

* simplify

* update other test

* [BUG FIX] [MER-2616] fix attempt count (#4263)

* [MER-2618] Forgot Password link throws 500 error

* [MER-2620] z-index issue between the page title and the create menu modal

* [MER-2617] Codeblock text appears too small

* [BUG FIX] [MER-2619] Hidden spaces in LTI Registration form values can cause 500 error on launch

* [MER-2621] Fix recommended actions (#4273)

* fix recommended schedule action for new course section

* extend tests for recommended schedule action for new course sections

* restrict pending activities count to current section resource attempts

* extend test for score questions not to count attempts for same resources of other sections

* [BUGFIX] [MER-2612] Scoring in assessment settings defaulting to average (#4259)

* [MER-2612] Show empty value on Scoring dropdown in Assessment Settings page

* [MER-2612] Add scoring_strategy_id to section resources function

* [BUGFIX][MER-2570] Fix error accessing project preview (#4244)

* [MER-2570] Adds fixes to render function

* [MER-2570] Some corrections

* addressed code review comments

---------

Co-authored-by: Nicolás Cirio <[email protected]>

* [BUG FIX] never show hints in graded context [MER-2624]

* [BUG FIX] Remove author specific columns [MER-2623]

* [BUG FIX] Empty slugs [MER-2625]

* [MER-2639] Post created flash appears in all active user windows (#4283)

* fix flash messages showing when other user submits a post, when other user leaves chatroom or when instructor approves users post

* do not consider deleted posts in number_of_posts count and in most_recent_post

* do not render 'most recent post:' if there are no posts yet

* add tests for posts counts and most recent post in discussion activity filtered by discussion

* [MER-2642] fix text search clear button (#4284)

* added missing on clauses

---------

Co-authored-by: Augusto Alonso <[email protected]>
Co-authored-by: Nicolás Cirio <[email protected]>
Co-authored-by: Santiago Simoncelli <[email protected]>
Co-authored-by: Eli Knebel <[email protected]>
Co-authored-by: Marc Hughes <[email protected]>
Co-authored-by: marc-hughes <[email protected]>
Co-authored-by: Gastón Abellá <[email protected]>
nicocirio added a commit that referenced this pull request Oct 18, 2023
* [MER-2570] Adds fixes to render function

* [MER-2570] Some corrections

* addressed code review comments

---------

Co-authored-by: Nicolás Cirio <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants