-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Added new structures dummy data generator #7621
Conversation
Hi, @aks681. This pull request does not have a "CHANGELOG: ..." label as mentioned in the PR checkbox list. Please add this label. PRs without this label will not be merged. If you are unsure of which label to add, please ask the reviewers for guidance. Thanks! |
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.
Thanks, @aks681! Took a full pass -- PTAL. (There's really just one main comment, but repeated multiple times.)
core/controllers/admin.py
Outdated
'ABC', is_initial_state=True) | ||
state.interaction.id = 'TextInput' | ||
state.content = state_domain.SubtitledHtml('1', question_content) | ||
state.recorded_voiceovers = state_domain.RecordedVoiceovers.from_dict( |
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.
This seems a little bit too "hardcoded", and may not transition well if subsequent changes are made to how questions are created. Would it be possible to construct the question using methods on the existing State and Question objects' domain-level API instead (e.g. add_hints() etc.)? In particular, do not set properties on the state/question objects directly.
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.
Yeah, shall I have create_dummy_<object>
functions and just pass in the variables here?
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.
No, don't add new functions to the domain layer. Couldn't we use the existing functions? (Like state.update_content() etc.)
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.
Yeah, done.
core/controllers/admin.py
Outdated
constants.SKILL_DIFFICULTIES[2], 'Explanation 3')] | ||
skill = skill_domain.Skill.create_default_skill( | ||
skill_id, skill_description, rubrics) | ||
skill.skill_contents = skill_domain.SkillContents( |
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.
Can you construct this part more programmatically using the methods on the Skill domain object API?
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.
Done
core/controllers/admin.py
Outdated
return skill | ||
|
||
def _load_dummy_new_structures_data(self): | ||
"""Loads the database with a topic, a story and three skills in the |
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.
Given @BenHenning's recent comments/questions, perhaps make this auto-generate two topics.
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.
Done, created a second empty topic.
core/controllers/admin.py
Outdated
|
||
topic = topic_domain.Topic.create_default_topic( | ||
topic_id, 'Dummy Topic 1') | ||
topic.canonical_story_references = [ |
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.
Ditto here and below, re using domain-level methods and not setting properties directly.
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.
Done
<h3>Load dummy new structures data (only admins)</h3> | ||
<div class="row"> | ||
<span class="col-lg-4 col-md-4 col-sm-4"> | ||
Loads a topic, a story and three skills (two in a subtopic) attached to the topic |
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.
Note that if we decide to auto-load two topics, this documentation needs to be updated.
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.
Done
Codecov Report
@@ Coverage Diff @@
## develop #7621 +/- ##
===========================================
+ Coverage 83.67% 83.69% +0.03%
===========================================
Files 1106 1106
Lines 64402 64499 +97
Branches 3654 3654
===========================================
+ Hits 53882 53980 +98
+ Misses 9336 9335 -1
Partials 1184 1184
|
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. Thank you, @aks681!
In Travis, the RUN_E2E_TESTS_ADDITIONAL_PLAYER_FEATURES suite is failing repeatedly with the following stack trace ... PTAL?
|
That's strange, I didn't modify any files related to that. Will try to replicate locally. |
Also adding @nithusha21 and @DubeySandeep for codeowner review. @lilithxxx -- question for you, it looks like the codecov/project/backend check is failing. Do we need to do anything about this (and, if so, what)? |
This PR is fully tested but seems like the current coverage of the codebase is not 100%. There's one untested line here, that's why codecov is blocking this PR. The line got untested in PR #7604 here. Codecov did not block that PR as it couldn't upload the coverage report. The complete log is:
The solution to this seems to be retrying till the coverage is uploaded successfully. Here is the context: link. Its kinda hacky but seems like that way codecov will not fail. Should I try this out in a PR? |
I think that line does not need to be tested, since it is only there for e2e tests. However, I have a question. How did #7604 even get submitted if codecov couldn't run? |
I think because codecov is not a required check. |
Hm ok. To your earlier question -- yes, please, it would be great if you could create a PR for the retries. I will try and fix the backend test issue in PR #7655. Thanks! |
Update: filed #7655 for the backend test issue. PTAL @lilithxxx -- thanks! |
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.
LGTM, thanks!
Explanation
This PR adds another button to the 'Activites' tab in the Admin page to generate dummy new structures data.
It creates a topic, links a story to the topic, links 3 skills to the topic and a question to each skill and categorizes 2 of the 3 skills into a subtopic. It also reloads 2 predefined explorations and adds it to the story.
Checklist
python -m scripts.pre_commit_linter
andpython -m scripts.run_frontend_tests
.