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

Added new structures dummy data generator #7621

Merged
merged 7 commits into from
Sep 24, 2019

Conversation

aks681
Copy link
Contributor

@aks681 aks681 commented Sep 14, 2019

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

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The linter/Karma presubmit checks have passed.
    • These should run automatically, but if not, you can manually trigger them locally using python -m scripts.pre_commit_linter and python -m scripts.run_frontend_tests.
  • The PR is made from a branch that's not called "develop".
  • The PR has an appropriate "PROJECT: ..." label (Please add this label for the first-pass review of the PR).
  • The PR has an appropriate "CHANGELOG: ..." label (If you are unsure of which label to add, ask the reviewers for guidance).
  • The PR follows the style guide.
  • The PR addresses the points mentioned in the codeowner checks for the files/folders changed. (See the codeowner's wiki page.)
  • The PR is assigned to an appropriate reviewer.
    • If you're a new contributor, please ask on Gitter for someone to assign a reviewer and don't tick this checkbox.
    • If you're not sure who the appropriate reviewer is, please assign to the issue's "owner" -- see the "talk-to" label on the issue. Do not only request the review but also add the reviewer as an assignee.

@oppiabot
Copy link

oppiabot bot commented Sep 14, 2019

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!

Copy link
Member

@seanlip seanlip left a 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 Show resolved Hide resolved
'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(
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, done.

constants.SKILL_DIFFICULTIES[2], 'Explanation 3')]
skill = skill_domain.Skill.create_default_skill(
skill_id, skill_description, rubrics)
skill.skill_contents = skill_domain.SkillContents(
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

return skill

def _load_dummy_new_structures_data(self):
"""Loads the database with a topic, a story and three skills in the
Copy link
Member

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.

Copy link
Contributor Author

@aks681 aks681 Sep 20, 2019

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.


topic = topic_domain.Topic.create_default_topic(
topic_id, 'Dummy Topic 1')
topic.canonical_story_references = [
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@seanlip seanlip assigned aks681 and unassigned seanlip Sep 17, 2019
@codecov
Copy link

codecov bot commented Sep 20, 2019

Codecov Report

Merging #7621 into develop will increase coverage by 0.03%.
The diff coverage is 100%.

@@             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
Flag Coverage Δ
#backend 100% <100%> (ø) ⬆️
#frontend 73.29% <ø> (ø) ⬆️
Impacted Files Coverage Δ
core/domain/topic_domain.py 100% <ø> (ø) ⬆️
core/controllers/admin.py 100% <100%> (ø) ⬆️
core/domain/skill_domain.py 100% <100%> (ø) ⬆️
...templates/dev/head/services/IdGenerationService.ts 100% <0%> (+16.67%) ⬆️

@aks681 aks681 assigned seanlip and unassigned aks681 Sep 20, 2019
Copy link
Member

@seanlip seanlip 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. Thank you, @aks681!

@seanlip
Copy link
Member

seanlip commented Sep 20, 2019

In Travis, the RUN_E2E_TESTS_ADDITIONAL_PLAYER_FEATURES suite is failing repeatedly with the following stack trace ... PTAL?

F    ✗ should give option for redirection when author has specified a refresher exploration Id
      - Failed: Could not find exploration tile with name Parent Exploration not in collection

Failures:
1) Full exploration editor should give option for redirection when author has specified a refresher exploration Id
  Message:
    Failed: Could not find exploration tile with name Parent Exploration not in collection
  Stack:
    Error: Failed: Could not find exploration tile with name Parent Exploration not in collection
        at /home/travis/build/oppia/oppia/node_modules/jasminewd2/index.js:64:48
        at ControlFlow.emit (/home/travis/build/oppia/oppia/node_modules/selenium-webdriver/lib/events.js:62:21)
        at ControlFlow.shutdown_ (/home/travis/build/oppia/oppia/node_modules/selenium-webdriver/lib/promise.js:2674:10)
        at shutdownTask_.MicroTask (/home/travis/build/oppia/oppia/node_modules/selenium-webdriver/lib/promise.js:2599:53)
10 specs, 1 failure
Finished in 854.814 seconds

@aks681
Copy link
Contributor Author

aks681 commented Sep 20, 2019

That's strange, I didn't modify any files related to that. Will try to replicate locally.

@seanlip seanlip assigned nithusha21, DubeySandeep and aks681 and unassigned seanlip Sep 20, 2019
@seanlip seanlip removed the request for review from kevinlee12 September 20, 2019 23:35
@seanlip
Copy link
Member

seanlip commented Sep 20, 2019

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)?

@lilithxxx
Copy link
Contributor

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:

Error: HTTPSConnectionPool(host='codecov.io', port=443): Max retries exceeded with url: /codecov/v4/raw/2019-09-17/6BBD04BAB28362906B7CAACFE0DF5AE7/0c88cf559bcb7f15a297dd3b26421857282fb475/15ca3dc1-2d7f-4cbd-be21-b934f7a34b39.txt?AWSAccessKeyId=AKIAIHLZSCQCS4WIHD4A&Expires=1568726448&Signature=ySd0BtSHoOpnjrvogq0fenmKChw%3D (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ff4709c9890>: Failed to establish a new connection: [Errno 110] Connection timed out',))

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?

@seanlip
Copy link
Member

seanlip commented Sep 21, 2019

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?

@lilithxxx
Copy link
Contributor

I think because codecov is not a required check.

@seanlip
Copy link
Member

seanlip commented Sep 21, 2019

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!

@seanlip
Copy link
Member

seanlip commented Sep 21, 2019

Update: filed #7655 for the backend test issue. PTAL @lilithxxx -- thanks!

Copy link
Contributor

@nithusha21 nithusha21 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@nithusha21 nithusha21 merged commit 3d06315 into oppia:develop Sep 24, 2019
@aks681 aks681 deleted the new-structures-generator branch November 1, 2019 12:17
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.

5 participants