-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Conversation
bching
commented
Oct 14, 2017
- explorationData to ExplorationDataService
- editorContextService to EditorStateService
- angularNameService to AngularNameService
* explorationData to ExplorationDataService * editorContextService to EditorStateService * angularNameService to AngularNameService
Hi @bching, Travis check is failing! |
Hi @bching, thanks. I guess there are linting errors still present and e2etest is failing ! |
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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! |
I think it's a legitimate issue -- see https://travis-ci.org/oppia/oppia/jobs/291538603#L686 |
Oops sorry, missed that! |
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.
Executed 53 of 53 specs (11 FAILED) in 1 hour 13 mins 16 secs. |
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)! |
@seanlip Ahhh sorry I misunderstood the conversation exchange. I removed the new line now. |
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> |
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.
Are these really needed 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.
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?
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.
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 :)
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 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?
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.
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 :)
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.
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.
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.
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); |
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.
Please indent it exactly below the above line ?
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.
I'm sorry if I misunderstood the request, but I removed the indent below line 385. Or should I increase the indent?
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.
} else { | ||
$scope.explorationStatisticsUrl = ( | ||
'/createhandler/statistics_old/' + explorationData.explorationId + | ||
'/createhandler/statistics_old/' + | ||
ExplorationDataService.explorationId + | ||
'/' + version); |
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 can be moved to the previous line.
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
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.
@bching, why am I not able to see this change ? Are you sure you committed it ?
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.
@shubha1593 I'm sorry I rolled back some changes because of the Travis errors. I moved it to the previous line now.
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.
@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?
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.
@bching Oops sorry, my bad! You're right.
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.
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.
@shubha1593 Ahhh, all right I have done so now.
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 @bching and so sorry for being late! I have left a few inline comments.
Hi @shubha1593 . I think this PR is up for a review |
@pranavsid98 Ah not quite yet, I trying to resolve the Travis errors from the last merge. |
7059120
to
6de9b5f
Compare
@shubha1593 This PR is up for review now. |
I think there's a line-length error, @bching? See https://travis-ci.org/oppia/oppia/jobs/300599652#L1256 |
dc3a817
to
ad62ead
Compare
@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 |
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.
Please add a period(.) at the end.
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
|
||
/** | ||
* @fileoverview A service that maintains a record of which state | ||
* in the exploration is currently active |
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.
Same, add period (.) at the end.
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
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.
Hi @bching ,
I have left some inline comments. Sorry for not catching them!
@@ -184,3 +184,100 @@ oppia.directive('trainingPanel', [ | |||
}; | |||
} | |||
]); | |||
|
|||
oppia.directive('trainingPanel', [function() { |
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.
@bching trainingPanel
directive is already there right? I guess you added a second copy 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.
@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() { |
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.
@bching Why have you added this here? We have a separate Spec file for it TrainingDataServiceSpec.js
, right?
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.
@shubha1593 I'm sorry, it wasn't intentional. I'm not sure how I ended up inserting it there... Removed it now.
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.
Great, thanks @bching, LGTM!
@@ -0,0 +1,116 @@ | |||
|
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.
@bching Please remove this line.
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.
@shubha1593 Done.
Hey @bching, just one more minor change required, then it's good to merge! |
…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) ...