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

Fix and test PL unit completion for contained levels #58306

Conversation

bethanyaconnor
Copy link
Contributor

@bethanyaconnor bethanyaconnor commented Apr 29, 2024

Fixes a case where, when a unit contained a bubble choice level, greater than 100% completion was being shown. To fix that, I changed the logic to look for the levels, instead of the units, associated with a UserLevel.

This did come with a side effect of not counting predict levels correctly. Predict levels are set up such that the Blockly level is in the ScriptLevel and contains the FreeResponse/Multi level. However, the UserLevel is created for the FreeResponse/Multi level. I added some special handling for that case.

I added a test for both BubbleChoice and predict levels.

I largely used the investigation in #57121 as a starting point here!

Warning!!

The AP CSP Create Performance Task is in progress. The most critical dates are from April 3 - April 30, 2024. Please consider any risk introduced by this PR that could affect our students taking AP CSP. Code.org students taking AP CSP primarily use App Lab for their Create Task, however a small percent use Game Lab. Carefully consider whether your change has any risk of alterering, changing, or breaking anything in these two labs. Even small changes, such as a different button color, are considered significant during this time period. Reach out to the Student Learning team or Curriculum team for more details.

Links

Testing story

Deployment strategy

Follow-up work

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@bethanyaconnor bethanyaconnor marked this pull request as ready for review April 29, 2024 16:59
@bethanyaconnor bethanyaconnor requested review from a team and etaderhold and removed request for a team April 29, 2024 16:59
@bethanyaconnor
Copy link
Contributor Author

Tagging Teacher Tools in case they have any insight!

Copy link
Contributor

@etaderhold etaderhold left a comment

Choose a reason for hiding this comment

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

This change LGTM.

I do wonder about the difference between this behavior of looking at all contained levels individually, vs. what we do on the progress table where we just look at the first contained level for non-bubble-choice levels. Are there good reasons to do things differently in these two places, or would it be better to standardize on one way?

def get_level_for_progress(student = nil, script = nil)

@bethanyaconnor
Copy link
Contributor Author

I do wonder about the difference between this behavior of looking at all contained levels individually, vs. what we do on the progress table where we just look at the first contained level for non-bubble-choice levels.

I think, in practice, levels can only have one (or zero) contained level, so they're effectively the same. But I would love to standardize on that and actually enforce it. Do you want me to change this logic to only look at the first contained level?

@etaderhold
Copy link
Contributor

I think, in practice, levels can only have one (or zero) contained level, so they're effectively the same.

I ran Level.all.filter{|level| !level.is_a?(BubbleChoice)}.filter {|level| (level.contained_levels.length rescue 0) > 1 } in a Rails console in my local dev environment and it came back with just two levels with more than one contained level. So yes, agreed that it's nearly always the same in practice.

But I would love to standardize on that and actually enforce it. Do you want me to change this logic to only look at the first contained level?

Sounds fine!

@bethanyaconnor bethanyaconnor merged commit 4ea752e into staging May 6, 2024
2 checks passed
@bethanyaconnor bethanyaconnor deleted the bethany/pl-discoverability/fix-completion-percent-for-contained-levels branch May 6, 2024 15:36
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.

None yet

2 participants