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

Just use default lessonExtras unless explicitly set #45492

Merged
merged 4 commits into from
Mar 30, 2022

Conversation

dmcavoy
Copy link
Contributor

@dmcavoy dmcavoy commented Mar 25, 2022

Instead of needing to determine if lesson extras or tts autoplay are available for a unit when updating the assigned unit we can simply things by just using the default values unless the values are explicitly set as part of creating or updating the section. There is no harm in having lessonExtras be true for a section which is assigned to a course without lesson extras. It just means if a student were to go work on a different course that was not assigned to them they might see the lesson extras.

Testing story

  • Updated the unit tests

@dmcavoy dmcavoy requested review from fontie715, tess323 and a team March 28, 2022 19:37
@tess323
Copy link

tess323 commented Mar 28, 2022

not super versed in this area, but fine by me pending a check-in with LP engineers per Amanda's slack request

@dmcavoy dmcavoy requested a review from a team March 29, 2022 00:05
@dmcavoy
Copy link
Contributor Author

dmcavoy commented Mar 29, 2022

Hey @code-dot-org/learning-platform I'm interested in hearing from you all about any risks you see with this change.

Here is what I'm thinking about. Right now you could have a suggestion that is assigned to Course D (which has lesson extras) and you could enable lesson extras when assigning that to the section. Then you could have students who are also working on Dance Party which does not have lesson extras. There is nothing I know of that breaks in that case and I would think that is a pretty common possibility of some CSF course being assigned but students doing other HOC tutorials.

Are there any things you can think of which I should check to make sure this change is safe?

I spoke with Amanda and she is fine with the default being updated to on.

Copy link
Member

@davidsbailey davidsbailey left a comment

Choose a reason for hiding this comment

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

code changes LGTM. I'll let others settle the question of user-facing behavior.

@dmcavoy
Copy link
Contributor Author

dmcavoy commented Mar 30, 2022

@jamescodeorg @maureensturgeon could I get one of your eyes on this today please? It is blocking the big assignment dropdown PR.

@@ -875,14 +873,13 @@ export default function teacherSections(state = initialState, action) {
}

const lessonExtraSettings = {};
if (action.props.scriptId && !action.props.lessonExtras) {
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 a bit confused about this case, if action.props.lessonExtras is false, we set lessonExtraSettings.lessonExtras to true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm good call out. I was going for if lessonExtras was null so I can update to that

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! I'm also slightly confused about why the unit tests were passing before, because it looked like that the case where action.props.lessonExtras is false was being tested. That might be worth looking into

@jamescodeorg
Copy link
Contributor

Sorry I missed this -- could you elaborate a bit more on the motivation behind the change? The existing logic doesn't look too bad, does this change unlock other simplifications with the broader assignment dropdown work?

(It feels a little strange to me to have these settings set on a section that doesn't need them but the way we do section assignment is already strange so I don't mind the change.)

@dmcavoy
Copy link
Contributor Author

dmcavoy commented Mar 30, 2022

Sorry I missed this -- could you elaborate a bit more on the motivation behind the change? The existing logic doesn't look too bad, does this change unlock other simplifications with the broader assignment dropdown work?

(It feels a little strange to me to have these settings set on a section that doesn't need them but the way we do section assignment is already strange so I don't mind the change.)

The reason I am exploring this change is because the way we currently are doing this requires that the Unit Overview and Course Overview page know about all the course offerings. This is because when you click the Assign button on those pages we need to know if the course has lesson extras in order to decide if we should set lesson extras to true for the section. Those pages especially the Unit Overview page already are slow to load so I was trying to cut down on the amount of information we were sending to those pages.

There is another way to get around this that I was considering if we don't want to move to this change. It was to pass down the lesson extras information for the course or unit to the page and then pass it through when assigning. Its just more information being passed around especially if the default we really want is people to use lesson extras unless they turn them off.

@maureensturgeon
Copy link
Contributor

Its just more information being passed around especially if the default we really want is people to use lesson extras unless they turn them off.

Another option here would be to load this information async only when it's needed, if we want to pass less information from the backend on load

@@ -875,14 +873,13 @@ export default function teacherSections(state = initialState, action) {
}

const lessonExtraSettings = {};
if (action.props.scriptId && !action.props.lessonExtras) {
lessonExtraSettings.lessonExtras = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: for someone new coming in, it may not be clear why this is being set to true. I think keeping the variable defaultLessonExtras makes the intent more clear

@jamescodeorg
Copy link
Contributor

jamescodeorg commented Mar 30, 2022

The reason I am exploring this change is because the way we currently are doing this requires that the Unit Overview and Course Overview page know about all the course offerings. This is because when you click the Assign button on those pages we need to know if the course has lesson extras in order to decide if we should set lesson extras to true for the section. Those pages especially the Unit Overview page already are slow to load so I was trying to cut down on the amount of information we were sending to those pages.

Thanks for the explanation! I don't have a good picture of how this all works but naively, it seems like part of the problem is that the front-end is responsible for too much logic. It seems like it should be possible for the course and unit overview pages to just say "please assign this course/unit to this section" and the back-end would apply reasonable defaults for the other parameters. That said, I'm fine with this approach so that we can unblock the larger work and maybe revisit this later if we want to clean it up further.

Copy link
Contributor

@jamescodeorg jamescodeorg left a comment

Choose a reason for hiding this comment

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

+1 to Maureen's comments on lessonExtras and ttsAutoplayEnabled but otherwise LGTM.

@dmcavoy dmcavoy merged commit d1ecec1 into staging Mar 30, 2022
@dmcavoy dmcavoy deleted the teacherSectionsRedux-updates branch March 30, 2022 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants