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

Code Break: Can set visible after for lesson #33869

Merged
merged 10 commits into from Mar 31, 2020
Merged

Conversation

dmcavoy
Copy link
Contributor

@dmcavoy dmcavoy commented Mar 26, 2020

Part 1 of PLAT-45

Levelbuilders can set visible_after on a stage in the script edit page. If the levelbuilder leaves the value for visible_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.

Screen Shot 2020-03-27 at 4 06 41 PM

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:

  • Tests provide adequate coverage
  • 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

@dmcavoy dmcavoy changed the title Record visible_after to script file and pull from script file to edit… [WIP] Release lesson at specified time Mar 26, 2020
@dmcavoy dmcavoy changed the title [WIP] Release lesson at specified time Code Break: Can set visible after for lesson Mar 27, 2020
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.

Looks great, Dani! Just a couple of comments inline.

dashboard/app/dsl/script_dsl.rb Outdated Show resolved Hide resolved
dashboard/app/dsl/script_dsl.rb Outdated Show resolved Hide resolved
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.

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.

Comment on lines 53 to 55
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)"
Copy link
Member

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:

  1. the banner is not visible when visible_after is absent
  2. 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)
  3. 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.
  4. no banner is visible for students

@dmcavoy dmcavoy requested a review from a team as a code owner March 30, 2020 21:55
@dmcavoy
Copy link
Contributor Author

dmcavoy commented Mar 31, 2020

Updated the flash notice to concat together when multiple lessons have visible after set.

Screen Shot 2020-03-31 at 3 51 54 PM

Added tests for:

  1. notice does not show if no visible after and levelbuilder
  2. notice does not show if visible after date in past and levelbuilder
  3. notice shows if visible after date is in future and levelbuilder
  4. notice does not show for visible after if student
  5. notice does not show for visible after if teacher

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.

Looks great, @dmcavoy, thanks for the updates!

@dmcavoy dmcavoy merged commit 0e9d8db into staging Mar 31, 2020
@dmcavoy dmcavoy deleted the code-break-time-release branch March 31, 2020 21:43
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

3 participants