Skip to content

Commit

Permalink
Introduce FetchPlaythroughWhitelistHandler (oppia#5966)
Browse files Browse the repository at this point in the history
* Fix hola's multiple choice question.

* Do not use default value for newWhitelistExplorationIds

* Pass whitelist from exploration player

* Undo DEV_MODE setting

* initial commit

* s/IssuesBackendApiService/PlaythroughIssuesBackendApiService

* fix syntax error

* add missing semicolon

* turn on dev mode

* remove unnecessary whitespace

* sort imports

* sort constants

* whitespace changes

* remove unused parameter

* remove unused parameter

* extract whitelist from response

* add acl decorator

* make access more strict

* better accessor

* Add docstring

* grant whitelist fetching open_access

* revert base_test

* revert acl change

* Use PlaythroughIssuesService to check whitelist

* s/Player/Learner

* s/isExplorationWhitelisted/isExplorationEligibleForPlaythroughIssues

* Fix syntax error

* stop passing whitelist

* s/this.ps/this.PlaythroughService

* Fix PlaythroughServiceSpec

* Allow explorations to be whitelisted for PlaythroughService tests

* Allow explicit whitelist for testing purposes

* Force whitelist for testing

* init the session directly

* pass correct value

* Fix logic

* expand service imports

* initialize PlaythroughIssuesService as well

* Fix line-too-long

* prefix parameter with testOnly

* Fix imports

* use dot-notation

* Move services to services directory

* Enable dev mode

* Fix import

* Add missing imports

* Add space

* define whitelistedExplorationIds

* group services

* sort services

* sort services

* nit spacing changes

* better parameter name

* remove unused whitelist variables

* Minor spacing fix

* Consolidate functions

* minor spacing fixes

* Prefer else if to early returns

* minor fixes

* Add JSDoc for initSession

* show optional-ness

* Use proper JSDoc notation for optional param
  • Loading branch information
brianrodri authored Dec 13, 2018
1 parent c9adae1 commit 6b23699
Show file tree
Hide file tree
Showing 13 changed files with 300 additions and 246 deletions.
21 changes: 16 additions & 5 deletions core/controllers/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,6 @@ def get(self, exploration_id):
except:
raise self.PageNotFoundException

whitelisted_exp_ids = (
config_domain.WHITELISTED_EXPLORATION_IDS_FOR_PLAYTHROUGHS.value)
self.values.update({
'whitelisted_exploration_ids_for_playthroughs': whitelisted_exp_ids
})
self.values.update(exploration_data)
self.render_json(self.values)

Expand Down Expand Up @@ -719,6 +714,22 @@ def post(self, exp_id):
self.render_json({})


class FetchPlaythroughWhitelistHandler(EditorHandler):
"""Handles fetching the whitelisted exploration ids which will record and
render playthroughs.
"""

GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON

@acl_decorators.open_access
def get(self):
"""Handle GET requests for the playthrough whitelist of explorations."""
self.render_json({
'whitelisted_exploration_ids_for_playthroughs':
config_domain.WHITELISTED_EXPLORATION_IDS_FOR_PLAYTHROUGHS.value
})


class ImageUploadHandler(EditorHandler):
"""Handles image uploads."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ oppia.controller('ExplorationEditor', [
ExplorationCorrectnessFeedbackService.init(
data.correctness_feedback_enabled);
StateClassifierMappingService.init(data.state_classifier_mapping);
PlaythroughIssuesService.initSession(
data.exploration_id, data.version,
data.whitelisted_exploration_ids_for_playthroughs);
PlaythroughIssuesService.initSession(data.exploration_id, data.version);

$scope.explorationTitleService = ExplorationTitleService;
$scope.explorationCategoryService = ExplorationCategoryService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,28 +212,9 @@
<script src="/templates/dev/head/components/SolutionExplanationEditorDirective.js"></script>
<script src="/templates/dev/head/components/StateGraphLayoutService.js"></script>
<script src="/templates/dev/head/components/VersionDiffVisualizationDirective.js"></script>
<script src="/templates/dev/head/services/AutoplayedVideosService.js"></script>
<script src="/templates/dev/head/components/summary_tile/CircularImageDirective.js"></script>
<script src="/templates/dev/head/components/summary_tile/ExplorationSummaryTileDirective.js"></script>
<script src="/templates/dev/head/components/RatingComputationService.js"></script>
<script src="/templates/dev/head/services/ExplorationHtmlFormatterService.js"></script>
<script src="/templates/dev/head/services/ExtensionTagAssemblerService.js"></script>
<script src="/templates/dev/head/services/MessengerService.js"></script>
<script src="/templates/dev/head/services/AudioPlayerService.js"></script>
<script src="/templates/dev/head/services/HtmlEscaperService.js"></script>
<script src="/templates/dev/head/services/AutogeneratedAudioPlayerService.js"></script>
<script src="/templates/dev/head/services/SpeechSynthesisChunkerService.js"></script>
<script src="/templates/dev/head/services/CodeNormalizerService.js"></script>
<script src="/templates/dev/head/services/ComputeGraphService.js"></script>
<script src="/templates/dev/head/services/EditabilityService.js"></script>
<script src="/templates/dev/head/services/GenerateContentIdService.js"></script>
<script src="/templates/dev/head/services/IssuesService.js"></script>
<script src="/templates/dev/head/services/LocalStorageService.js"></script>
<script src="/templates/dev/head/services/SchemaDefaultValueService.js"></script>
<script src="/templates/dev/head/services/SchemaUndefinedLastElementService.js"></script>
<script src="/templates/dev/head/services/NestedDirectivesRecursionTimeoutPreventionService.js"></script>
<script src="/templates/dev/head/services/StateTopAnswersStatsService.js"></script>
<script src="/templates/dev/head/services/SiteAnalyticsService.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/EditorNavbarBreadcrumbDirective.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/EditorNavigationDirective.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/ExplorationPropertyService.js"></script>
Expand Down Expand Up @@ -304,9 +285,7 @@
<script src="/templates/dev/head/pages/exploration_editor/statistics_tab/BarChartDirective.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/statistics_tab/PieChartDirective.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/statistics_tab/LearnerActionRenderService.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/statistics_tab/PlaythroughIssuesService.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/statistics_tab/IssuesDirective.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/statistics_tab/IssuesBackendApiService.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/statistics_tab/EarlyQuitIssueDirective.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/statistics_tab/MultipleIncorrectIssueDirective.js"></script>
<script src="/templates/dev/head/pages/exploration_editor/statistics_tab/CyclicTransitionsIssueDirective.js"></script>
Expand Down Expand Up @@ -334,8 +313,31 @@
<script src="/templates/dev/head/domain/exploration/ReadOnlyExplorationBackendApiService.js"></script>
<script src="/templates/dev/head/domain/question/PretestQuestionBackendApiService.js"></script>
<script src="/templates/dev/head/domain/summary/ExplorationSummaryBackendApiService.js"></script>

<script src="/templates/dev/head/services/AssetsBackendApiService.js"></script>
<script src="/templates/dev/head/services/AudioPlayerService.js"></script>
<script src="/templates/dev/head/services/AutogeneratedAudioPlayerService.js"></script>
<script src="/templates/dev/head/services/AutoplayedVideosService.js"></script>
<script src="/templates/dev/head/services/CodeNormalizerService.js"></script>
<script src="/templates/dev/head/services/ComputeGraphService.js"></script>
<script src="/templates/dev/head/services/EditabilityService.js"></script>
<script src="/templates/dev/head/services/ExplorationHtmlFormatterService.js"></script>
<script src="/templates/dev/head/services/ExtensionTagAssemblerService.js"></script>
<script src="/templates/dev/head/services/GenerateContentIdService.js"></script>
<script src="/templates/dev/head/services/HtmlEscaperService.js"></script>
<script src="/templates/dev/head/services/IssuesService.js"></script>
<script src="/templates/dev/head/services/LocalStorageService.js"></script>
<script src="/templates/dev/head/services/MessengerService.js"></script>
<script src="/templates/dev/head/services/NestedDirectivesRecursionTimeoutPreventionService.js"></script>
<script src="/templates/dev/head/services/PlaythroughIssuesBackendApiService.js"></script>
<script src="/templates/dev/head/services/PlaythroughIssuesService.js"></script>
<script src="/templates/dev/head/services/PlaythroughService.js"></script>
<script src="/templates/dev/head/services/SchemaDefaultValueService.js"></script>
<script src="/templates/dev/head/services/SchemaUndefinedLastElementService.js"></script>
<script src="/templates/dev/head/services/SiteAnalyticsService.js"></script>
<script src="/templates/dev/head/services/SpeechSynthesisChunkerService.js"></script>
<script src="/templates/dev/head/services/StateTopAnswersStatsBackendApiService.js"></script>
<script src="/templates/dev/head/services/StateTopAnswersStatsService.js"></script>

<script src="/templates/dev/head/domain/classifier/AnswerClassificationResultObjectFactory.js"></script>
<script src="/templates/dev/head/domain/classifier/ClassifierObjectFactory.js"></script>
Expand Down Expand Up @@ -390,7 +392,6 @@
<script src="/templates/dev/head/pages/exploration_player/AnswerClassificationService.js"></script>
<script src="/templates/dev/head/pages/exploration_player/StateClassifierMappingService.js"></script>
<script src="/templates/dev/head/pages/exploration_player/PredictionAlgorithmRegistryService.js"></script>
<script src="/templates/dev/head/pages/exploration_player/PlaythroughService.js"></script>
<script src="/templates/dev/head/pages/exploration_player/CurrentInteractionService.js"></script>

<script src="/templates/dev/head/pages/exploration_player/InputResponsePairDirective.js"></script>
Expand Down
Loading

0 comments on commit 6b23699

Please sign in to comment.