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

Fix part of #3826: extract from EditorServices.js #3970

Merged
merged 16 commits into from
Nov 17, 2017

Conversation

bching
Copy link
Contributor

@bching bching commented Oct 14, 2017

  • explorationData to ExplorationDataService
  • editorContextService to EditorStateService
  • angularNameService to AngularNameService

* explorationData to ExplorationDataService
* editorContextService to EditorStateService
* angularNameService to AngularNameService
@bching bching requested a review from shubha1593 October 14, 2017 11:28
@shubha1593
Copy link
Contributor

Hi @bching, Travis check is failing!

@shubha1593
Copy link
Contributor

Hi @bching, thanks. I guess there are linting errors still present and e2etest is failing !

@codecov-io
Copy link

codecov-io commented Oct 23, 2017

Codecov Report

Merging #3970 into develop will increase coverage by 0.01%.
The diff coverage is 26.4%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3970      +/-   ##
===========================================
+ Coverage    43.92%   43.94%   +0.01%     
===========================================
  Files          352      355       +3     
  Lines        22299    22298       -1     
  Branches      3540     3540              
===========================================
+ Hits          9795     9798       +3     
+ Misses       12504    12500       -4
Impacted Files Coverage Δ
...ation_editor/history_tab/CompareVersionsService.js 96.66% <ø> (ø) ⬆️
...loration_editor/editor_tab/TrainingModalService.js 2.94% <ø> (ø) ⬆️
.../exploration_editor/UserEmailPreferencesService.js 3.7% <ø> (ø) ⬆️
.../dev/head/components/AnswerGroupEditorDirective.js 0.87% <ø> (ø) ⬆️
...mplates/dev/head/components/RuleEditorDirective.js 1.16% <ø> (ø) ⬆️
...n_editor/editor_tab/StateContentEditorDirective.js 67.34% <ø> (ø) ⬆️
...ges/exploration_editor/feedback_tab/FeedbackTab.js 0.72% <0%> (ø) ⬆️
...ad/components/OutcomeDestinationEditorDirective.js 2.27% <0%> (ø) ⬆️
...es/exploration_editor/editor_tab/StateResponses.js 2.6% <0%> (ø) ⬆️
...s/exploration_editor/editor_tab/StateStatistics.js 4.54% <0%> (ø) ⬆️
... and 28 more

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 d9e1592...2e614c0. Read the comment docs.

@shubha1593
Copy link
Contributor

Hi @seanlip, Travis seems to fail on the RUN_LINT test, but seeing the logs I think it's an issue with travis. I tried restarting the job but it's failing again!

@seanlip
Copy link
Member

seanlip commented Oct 25, 2017

I think it's a legitimate issue -- see https://travis-ci.org/oppia/oppia/jobs/291538603#L686

@shubha1593
Copy link
Contributor

Oops sorry, missed that!

@bching
Copy link
Contributor Author

bching commented Oct 27, 2017

Hmm... so the Travis linter is at fault? However I am receiving these errors from running e2e tests on my local. I am not certain which or if all of them are the fault of my code.


  •                Failures                    *
    

  1. Exploration history should display the history
  • Failed: unknown error: Element ... is not clickable at point (1061, 361). Other element would receive the click:
    ...

    (Session info: chrome=61.0.3163.100)
    (Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.12.5 x86_64)
  1. Site language should not change in an exploration
  • Expected 'Type a number' to equal 'Ingresa un número'.
  1. Learner dashboard functionality displays incomplete and completed collections
  1. Parameters should navigate multiple states correctly, with parameters
  • Failed: No element found using locator: By(css selector, .protractor-test-add-param-button)
  1. rich-text components should display correctly
  • Expected 'oppia-noninteractive-tabs' to be 'oppia-noninteractive-link'.
  • Expected '' to be 'http://google.com/'.
  • Expected '' to be '_blank'.
  • Expected 'oppia-noninteractive-collapsible' to be 'oppia-noninteractive-math'.
  • Expected null to match 'abc'.
  • Expected 'oppia-noninteractive-math' to be 'oppia-noninteractive-collapsible'.
  • Failed: No element found using locator: By(css selector, .protractor-test-collapsible-heading)
  1. State editor should open appropriate modal on re-clicking an interaction to customize it
  • Failed: unknown error: Element ... is not clickable at point (755, 281). Other element would receive the click:
    ...

    (Session info: chrome=61.0.3163.100)
    (Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.12.5 x86_64)
  1. State editor should add a solution
  • Failed: unknown error: Element ... is not clickable at point (428, 841). Other element would receive the click:

    (Session info: chrome=61.0.3163.100)
    (Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.12.5 x86_64)
  1. Oppia static pages tour visits the donate link
  • Failed: No element found using locator: By(css selector, .protractor-test-donate-link)
  1. Oppia static pages tour visits the terms page
  • Failed: No element found using locator: By(css selector, .protractor-test-terms-link)
  1. Oppia static pages tour visits the privacy page
  • Failed: No element found using locator: By(css selector, .protractor-test-privacy-policy-link)
  1. Suggestions on Explorations accepts a suggestion on a published exploration
  • Expected 0 to equal 1.
  • Expected undefined to match 'Uppercased the first letter'.
  • Failed: Cannot read property 'click' of undefined

Executed 53 of 53 specs (11 FAILED) in 1 hour 13 mins 16 secs.

@seanlip
Copy link
Member

seanlip commented Oct 27, 2017

Hi @bching -- actually, the e2e/protractor tests are passing fine on Travis, so it's possible that this is something to do with your local machine. What @shubha1593 was referring to was the linting check -- see 7663.9 in this link. One of your files has a small lint error due to a newline character check failing. If you could fix that, then this PR is probably good to go (at least from Travis's perspective)!

@bching
Copy link
Contributor Author

bching commented Oct 27, 2017

@seanlip Ahhh sorry I misunderstood the conversation exchange. I removed the new line now.

@seanlip
Copy link
Member

seanlip commented Oct 27, 2017

Thanks, @bching! I'm going to defer to @shubha1593 for review on this.

@@ -117,6 +117,9 @@

{# TODO(bhenning): Remove these once RouterServices is decoupled from the exploration editor #}
<script src="{{TEMPLATE_DIR_PREFIX}}/pages/exploration_editor/EditorServices.js"></script>
<script src="{{TEMPLATE_DIR_PREFIX}}/pages/exploration_editor/ExplorationDataService.js"></script>
<script src="{{TEMPLATE_DIR_PREFIX}}/pages/exploration_editor/EditorStateService.js"></script>
<script src="{{TEMPLATE_DIR_PREFIX}}/pages/exploration_editor/AngularNameService.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these really needed 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.

Done. They are removed now.

If you are checking if these services are dependent on another, should I generally just do a grep on the file names and see if they are referenced by files within another directory i.e. collection_editor?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I meant you had to analyse it before removing! I don't know for sure whether all would be removed or not.
Check out this, here I have tried to explain how I would go about analysing it. (See the comments for file admin.html). Let me know if you have any questions :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the link with the great explanation.
So ExplorationDataService is a dependency within EditorServices; EditorStateService is a dependency within RouterService; and AngularNameService is a dependency within EditorServices. EditorServices and RouterService are imported in collection_editor, so I believe they are needed here if my thinking is correct?

Copy link
Contributor

@shubha1593 shubha1593 Nov 10, 2017

Choose a reason for hiding this comment

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

Hi @bching, yup as much as I've checked these are needed here.
In general, you had to see, for example, if we need to include AngularNameService.js:
-AngularNameService is being directly used anywhere in collection_editor (say, there was a direct mention of AngularNameService in any of the services defined in collection_editor)
or
-Any other service which depends on AngularNameService (directly or indirectly) is being used in collection_editor.

We have AngularNameService defined in EditorServices.js and it is a dependency in ExplorationStateService (also defined in EditorServices.js). Now it might not be enough to say that as EditorServices.js is imported in collection_editor, so will also need AngularNameService.js. As it can be the case,(just for example sake consider), that in collection_editor we were using the changeListService only, because of which we needed to import EditorServices but then there would have been no need of importing AngularNameService too as changeListService does not depend on it.
In short you had to see the subset of services defined in EditorServices.js that depend on AngularNameService and whether those services were being used in collection_editor.

The reason why we need AngularNameService is because explorationStatesService has it as a dependency, and RouterService (defined in RouterService.js) has explorationStatesService as a dependency (so indirect dependency on AngularNameService). And in collection_editor we need RouterService.js, so we check which service defined in RouterService.js is actually needed by collection_editor. But as there is just one service present in RouterService.js we know for sure that RouterService is the one needed by collection_editor. So we can now say for sure that AngularNameService.js is also required by collection_editor.

Hope I haven't confused you :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then, one possible outcome of extracting these services into discrete files is a reduction in the number of imports in a page?

That was a good explanation. Thank you for clearing things up further.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well yup, reduction in some pages and increase for some. I think the advantage of having separate file for each service, in terms of import would be that now each page would be including only the services really needed by it.

@@ -578,11 +382,12 @@ oppia.factory('explorationRightsService', [
var that = this;

var explorationModeratorRightsUrl = (
'/createhandler/moderatorrights/' + explorationData.explorationId);
'/createhandler/moderatorrights/' +
ExplorationDataService.explorationId);
Copy link
Contributor

@shubha1593 shubha1593 Nov 1, 2017

Choose a reason for hiding this comment

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

Please indent it exactly below the above line ?

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'm sorry if I misunderstood the request, but I removed the indent below line 385. Or should I increase the indent?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, right had to indent line 386 to be exactly under line 385 like

indent

} else {
$scope.explorationStatisticsUrl = (
'/createhandler/statistics_old/' + explorationData.explorationId +
'/createhandler/statistics_old/' +
ExplorationDataService.explorationId +
'/' + version);
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be moved to the previous line.

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@bching, why am I not able to see this change ? Are you sure you committed it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shubha1593 I'm sorry I rolled back some changes because of the Travis errors. I moved it to the previous line now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shubha1593 I restarted the linter job on Travis but it appears it failed on the new commit. Perhaps it is a bit too long for the linter to pass?

Copy link
Contributor

Choose a reason for hiding this comment

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

@bching Oops sorry, my bad! You're right.

Copy link
Contributor

@shubha1593 shubha1593 Nov 12, 2017

Choose a reason for hiding this comment

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

Oh no wait, you moved ExplorationDataService.explorationId + to previous line. I meant move '/' + version); to previous line like
update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shubha1593 Ahhh, all right I have done so now.

Copy link
Contributor

@shubha1593 shubha1593 left a comment

Choose a reason for hiding this comment

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

Thanks @bching and so sorry for being late! I have left a few inline comments.

@pranavsid98 pranavsid98 assigned shubha1593 and unassigned bching Nov 7, 2017
@pranavsid98
Copy link
Contributor

Hi @shubha1593 . I think this PR is up for a review

@bching
Copy link
Contributor Author

bching commented Nov 7, 2017

@pranavsid98 Ah not quite yet, I trying to resolve the Travis errors from the last merge.

…nto extract-editorservice"

This reverts commit d98998c, reversing
changes made to 84dcff2.
@bching bching force-pushed the extract-editorservice branch from 7059120 to 6de9b5f Compare November 7, 2017 12:30
@bching
Copy link
Contributor Author

bching commented Nov 8, 2017

@shubha1593 This PR is up for review now.

@seanlip
Copy link
Member

seanlip commented Nov 12, 2017

I think there's a line-length error, @bching? See https://travis-ci.org/oppia/oppia/jobs/300599652#L1256

@bching bching force-pushed the extract-editorservice branch from dc3a817 to ad62ead Compare November 12, 2017 14:30
@bching
Copy link
Contributor Author

bching commented Nov 12, 2017

@seanlip Yes, I was fiddling with the wrong line in a previous commit, it should be resolved now.

// limitations under the License.

/**
* @fileoverview A service that maps IDs to Angular names
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a period(.) at the end.

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


/**
* @fileoverview A service that maintains a record of which state
* in the exploration is currently active
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, add period (.) at the end.

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

Copy link
Contributor

@shubha1593 shubha1593 left a comment

Choose a reason for hiding this comment

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

Hi @bching ,
I have left some inline comments. Sorry for not catching them!

@@ -184,3 +184,100 @@ oppia.directive('trainingPanel', [
};
}
]);

oppia.directive('trainingPanel', [function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@bching trainingPanel directive is already there right? I guess you added a second copy 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.

@shubha1593 Sorry, it looks like I somehow did. Removed now.

@@ -124,4 +124,336 @@ describe('State Editor controller', function() {
expect(scs.savedMemento.getHtml()).toEqual('This is some content.');
});
});

describe('TrainingDataService', function() {
Copy link
Contributor

@shubha1593 shubha1593 Nov 14, 2017

Choose a reason for hiding this comment

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

@bching Why have you added this here? We have a separate Spec file for it TrainingDataServiceSpec.js, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shubha1593 I'm sorry, it wasn't intentional. I'm not sure how I ended up inserting it there... Removed it now.

@shubha1593 shubha1593 changed the title Partial Fix #3826: extract from EditorServices.js Fix part of #3826: extract from EditorServices.js Nov 14, 2017
Copy link
Contributor

@shubha1593 shubha1593 left a comment

Choose a reason for hiding this comment

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

Great, thanks @bching, LGTM!

@@ -0,0 +1,116 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

@bching Please remove this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shubha1593 Done.

@shubha1593
Copy link
Contributor

Hey @bching, just one more minor change required, then it's good to merge!

@shubha1593 shubha1593 merged commit c3457f6 into oppia:develop Nov 17, 2017
giritheja added a commit to giritheja/oppia that referenced this pull request Nov 25, 2017
…t-p2

* upstream/develop: (129 commits)
  Fix 3946: Add visualization for Item selection inputs (oppia#4080)
  Remove feedback button from mobile learner view. (oppia#4093)
  Fix oppia#3289: Introduce domain objects for answer calculation output (oppia#4036)
  Renamed RTC_specs to RTC_definitions and removed useless __init__.py file. (oppia#4101)
  Fix exploration graph directive URL. (oppia#4098)
  Fix error in one off stats migration job. (oppia#4068)
  Add state id mapping mapreduce job to the job registry (oppia#4099)
  Added underline to 'Back to collection' link (oppia#4096)
  Minor updates to CHANGELOG v2.5.6 after proofreading (oppia#4097)
  Update Authors, Contributors, Changelog, Credits for Release 2.5.6. (oppia#4095)
  Prevent hint tooltip from going offscreen on mobile (oppia#4087)
  Implement one off MapRreduce job to generate state id mapping model for explorations. (oppia#4088)
  Routine update of translations. (oppia#4082)
  Fix part of oppia#3954: Created a Page Object for Thanks Page (oppia#4085)
  Rename CSS property oppia-learner-continue-button to oppia-learner-confirm-button; Make the Submit button in ItemSelectionInput the same style as the Continue button; Move informational text in ItemSelectionInput from bottom-right to top of the interaction so that it is more visible; Add extra text to ItemSelectionInput indicating to the learner that they may select more than one choice. (oppia#4083)
  Stop cards from going offscreen in mobile learner view. (oppia#4084)
  Upgrade SSL library version; remove obsolete challenge-response handler. (oppia#4081)
  Fix part of oppia#3826: extract from EditorServices.js (oppia#3970)
  Fix part of oppia#3826: Extract services from app.js (oppia#4079)
  Fix oppia#4055: Replaced redundant CSS selectors. (oppia#4059)
  ...
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