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
Code Break: Can set visible after for lesson #33869
Conversation
… page. Add test for feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, Dani! Just a couple of comments inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, Dani, but I've got a couple additional comments. apologies, but I'm asking for a lot of tests because this is one of those features that we'll need to be sure is going to do what we expect.
formatted_time = Time.parse(stage.visible_after).strftime("%I:%M %p %A %B %d %Y %Z") | ||
num_days_away = ((Time.parse(stage.visible_after) - Time.now) / 1.day).ceil.to_s | ||
flash[:notice] = "The lesson #{stage.name} will be visible after #{formatted_time} (#{num_days_away} Days)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also test the following scenarios:
- the banner is not visible when
visible_after
is absent - the banner is not visible if the time indicated by
visible_after
has passed (this may be easier to implement after you've added the code to actually hide the lesson, so ok to do in a later PR) - we should do something reasonable if 2 lessons are hidden. if the current code means that both banners appear, that's great. but if one replaces the other, then we might need to do something different -- anything that will prevent a nasty surprise where a lesson remains hidden when we need it to be visible.
- no banner is visible for students
Updated the flash notice to concat together when multiple lessons have visible after set. Added tests for:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @dmcavoy, thanks for the updates!
Part 1 of PLAT-45
Levelbuilders can set
visible_after
on a stage in the script edit page. If the levelbuilder leaves the value forvisible_after
blank (''
) then it will default to the next Wednesday at 8am PST. The value will be saved in the.script
file and loaded onto the script edit page the next time the level is edited.In addition when you go to the script overview page as a levelbuilder you will see a flash notice that lets you know when a lesson will be visible after.
Follow up work: Next up is using this value to determine if the stage is hidden.
Links
Testing story
Added tests to script_dsl_test.rb for parsing the DSL and serializing stage.
Reviewer Checklist: