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

Fixes #5402: State domain refactor #5505

Merged
merged 14 commits into from
Aug 16, 2018

Conversation

kevintab95
Copy link
Member

Explanation

Fixes #5402: Moved state class from exp_domain to state_domain. Also, moved related functions to state_services.

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes.
  • The PR explanation includes the words "Fixes #bugnum: ...".
  • The linter/Karma presubmit checks have passed.
    • These should run automatically, but if not, you can manually trigger them locally using python scripts/pre_commit_linter.py and bash scripts/run_frontend_tests.sh.
  • The PR is made from a branch that's not called "develop".
  • The PR follows the style guide.
  • The PR is assigned to an appropriate reviewer.
    • If you're a new contributor, please ask on Gitter for someone to assign a reviewer.
    • 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.

@codecov-io
Copy link

codecov-io commented Aug 13, 2018

Codecov Report

Merging #5505 into develop will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #5505   +/-   ##
========================================
  Coverage    45.71%   45.71%           
========================================
  Files          504      504           
  Lines        29751    29751           
  Branches      4502     4502           
========================================
  Hits         13602    13602           
  Misses       16149    16149

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f52af23...017e020. Read the comment docs.

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, @kevintab95! This is a great start. I left some comments, PTAL. But overall it looks pretty clean!

@@ -31,6 +31,7 @@
from core.domain import html_validation_service
from core.domain import interaction_registry
from core.domain import param_domain
import core.domain.state_domain as state_domain
Copy link
Member

Choose a reason for hiding this comment

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

Ah, no, could you please do "from core.domain import state_domain", same as all the others?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member Author

Choose a reason for hiding this comment

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

Used import that way because of a cyclic dependency problem. Moving the constituents of state to state_domain solved it, thanks!

# See the License for the specific language governing permissions and
# limitations under the License.

"""Domain object for state."""
Copy link
Member

Choose a reason for hiding this comment

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

Ah, we should put all the constituents of state here as well. I.e. Interaction, AnswerGroups, etc. -- basically, everything that a state consists of.

(Please modify the fileoverview docstring accordingly.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -0,0 +1,543 @@
# coding: utf-8
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't there be tests for this file?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I'll push tests for this tomorrow. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved relevant tests from exp_domain_test to state_domain_test. Can you PTAL @seanlip? Thanks!

@@ -0,0 +1,45 @@
# coding: utf-8
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't there be tests for this file?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed file.

# See the License for the specific language governing permissions and
# limitations under the License.

"""Commands that can be used to operate on states"""
Copy link
Member

Choose a reason for hiding this comment

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

Add period at end.

That said, I think you can get rid of this file, and have a classmethod on the State object instead. Something like State.convert_state_dict_to_yaml(). Then use cls.from_dict(state_dict) within it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@oppiabot
Copy link

oppiabot bot commented Aug 14, 2018

Hi @kevintab95. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. 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.

This looks really nice. Thank you @kevintab95! LGTM.

@seanlip
Copy link
Member

seanlip commented Aug 15, 2018

Well, it looks almost nice -- Travis tests are failing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants