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

Add vocabulary model and migrations #38392

Merged
merged 2 commits into from
Jan 7, 2021
Merged

Conversation

bethanyaconnor
Copy link
Contributor

@bethanyaconnor bethanyaconnor commented Jan 5, 2021

Adds the model and migrations for the vocabulary model.

I decided to add a key as the spec calls out a likelihood that some courses will have multiple definitions per word (in the case of Common Sense). For now, my plan was to make the key equal to the word.

This PR adds the vocabulary/course version association but the lesson/vocabulary association will come in a later PR in order to limit the number of migrations per PR.

Links

Testing story

Reviewer 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 January 6, 2021 18:03
@@ -807,6 +807,13 @@
description 'fake description'
end

factory :vocabulary do
association :course_version
key 'word'
Copy link
Member

Choose a reason for hiding this comment

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

in order to create more than one of these, I think we will want this to be a sequence, e.g.

sequence(:key) {|n| "objective-#{n}"}

also, just confirming my understanding that this will be an opaque id generated with something like SecureRandom.uuid, is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was originally thinking that key would be the word to start with but I think what you said makes more sense. We'll still need to prevent curriculum writers adding multiple definitions for the same word for now but I think that can be done in other ways. I'll add this sequence to the factory.

Copy link
Member

Choose a reason for hiding this comment

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

should we consider just getting rid of the key column and having word be the key? sorry to add more options here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't be sorry -- I've been going back and forth between a bunch of these options! I thought about that but it's likely we will want to have multiple definitions for a handful of words. I thought about adding the key then but then we'd have to backfill everything already in the database.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to summarize what we talked about offline -- we know we will need to have multiple definitions per word at some point, though not in the near term. We also need a unique identifier that is human-readable-ish in order to embed them in markdown. So, we will set the key to be the word in the near term and, in the future, generate human-readable alternate keys for duplicate definitions, like we do for resources

Copy link
Contributor

@dmcavoy dmcavoy left a comment

Choose a reason for hiding this comment

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

Looks good to me

@bethanyaconnor bethanyaconnor merged commit 7501460 into staging Jan 7, 2021
@bethanyaconnor bethanyaconnor deleted the add-vocab-models branch January 7, 2021 21:58
@bethanyaconnor bethanyaconnor mentioned this pull request Jan 25, 2021
8 tasks
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