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

Start creating a script to copy level concept difficulty from year to year #40679

Merged
merged 3 commits into from May 21, 2021

Conversation

dmcavoy
Copy link
Contributor

@dmcavoy dmcavoy commented May 20, 2021

Mike reported in slack that the level_concept_difficulty for levels in 2020 did not get copied over from 2019. This means that also 2021 did not get the level_concept_difficulty information either. This script will allow us to look for the parent_level_id for a level, which we set when we copy levels using either clone_with_name or clone_with_suffix. Using the parent_level_id we can find out the level_concept_difficulty for the parent level and then duplicate it and add it to the original level.

This script will need to be run on levelbuilder since that is where we cloned the scripts and level ids are specific to the environment.

Links

https://codedotorg.atlassian.net/browse/PLAT-1066

Testing story

  • Locally I copied a level that has level_concept_difficulty
  • Then I tried running copy_lcd_from_parent on the copied level and it worked

I can't test the script fully locally because the parent_level_ids are specific to levelbuilder.

@dmcavoy dmcavoy changed the title Start creating a script to copy from year to year Start creating a script to copy level concept difficulty from year to year May 20, 2021
@dmcavoy dmcavoy requested a review from a team May 21, 2021 01:10
#make a new level_concept_difficulty that is same as parent_levels
new_lcd = parent_level.level_concept_difficulty.dup
# Assign it to the level
level.level_concept_difficulty = new_lcd
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to save new_lcd here? level_id should have changed but I think it's saves regardless

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like it updated the level_id when I ran this method with my test level locally so I think it works. Yay magic!

Copy link
Contributor

@bethanyaconnor bethanyaconnor left a comment

Choose a reason for hiding this comment

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

Makes sense to me. Pondering some Rails magic in a comment but I don't think you need to make any updates

@dmcavoy dmcavoy merged commit fceb882 into staging May 21, 2021
@dmcavoy dmcavoy deleted the level-concept-difficulty-copy branch May 21, 2021 19:10
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