diff --git a/src/addon/mod/choice/components/index/index.html b/src/addon/mod/choice/components/index/index.html
index 870b14089..1e95f3cad 100644
--- a/src/addon/mod/choice/components/index/index.html
+++ b/src/addon/mod/choice/components/index/index.html
@@ -32,6 +32,12 @@
{{ 'core.hasdatatosync' | translate:{$a: moduleName} }}
+
+
+
+ {{ publishInfo | translate }}
+
+
diff --git a/src/addon/mod/choice/components/index/index.ts b/src/addon/mod/choice/components/index/index.ts
index b1dd2c9bf..3691ca893 100644
--- a/src/addon/mod/choice/components/index/index.ts
+++ b/src/addon/mod/choice/components/index/index.ts
@@ -42,6 +42,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
data = [];
labels = [];
results = [];
+ publishInfo: string; // Message explaining the user what will happen with his choices.
protected userId: number;
protected syncEventName = AddonModChoiceSyncProvider.AUTO_SYNCED;
@@ -238,6 +239,36 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
this.canEdit = isOpen && (this.choice.allowupdate || !hasAnswered);
this.canDelete = isOpen && this.choice.allowupdate && hasAnswered;
this.options = options;
+
+ if (this.canEdit) {
+
+ // Calculate the publish info message.
+ switch (this.choice.showresults) {
+ case AddonModChoiceProvider.RESULTS_NOT:
+ this.publishInfo = 'addon.mod_choice.publishinfonever';
+ break;
+
+ case AddonModChoiceProvider.RESULTS_AFTER_ANSWER:
+ if (this.choice.publish == AddonModChoiceProvider.PUBLISH_ANONYMOUS) {
+ this.publishInfo = 'addon.mod_choice.publishinfoanonafter';
+ } else {
+ this.publishInfo = 'addon.mod_choice.publishinfofullafter';
+ }
+ break;
+
+ case AddonModChoiceProvider.RESULTS_AFTER_CLOSE:
+ if (this.choice.publish == AddonModChoiceProvider.PUBLISH_ANONYMOUS) {
+ this.publishInfo = 'addon.mod_choice.publishinfoanonclose';
+ } else {
+ this.publishInfo = 'addon.mod_choice.publishinfofullclose';
+ }
+ break;
+
+ default:
+ // No need to inform the user since it's obvious that the results are being published.
+ this.publishInfo = '';
+ }
+ }
});
});
}
diff --git a/src/addon/mod/choice/lang/en.json b/src/addon/mod/choice/lang/en.json
index 12e82dee0..7a8a95ea6 100644
--- a/src/addon/mod/choice/lang/en.json
+++ b/src/addon/mod/choice/lang/en.json
@@ -9,6 +9,11 @@
"numberofuser": "Number of responses",
"numberofuserinpercentage": "Percentage of responses",
"previewonly": "This is just a preview of the available options for this activity. You will not be able to submit your choice until {{$a}}.",
+ "publishinfoanonafter": "Anonymous results will be published after you answer.",
+ "publishinfoanonclose": "Anonymous results will be published after the activity is closed.",
+ "publishinfofullafter": "Full results, showing everyone's choices, will be published after you answer.",
+ "publishinfofullclose": "Full results, showing everyone's choices, will be published after the activity is closed.",
+ "publishinfonever": "The results of this activity will not be published after you answer.",
"removemychoice": "Remove my choice",
"responses": "Responses",
"responsesresultgraphdescription": "{{number}}% of the users chose the option: {{text}}.",
diff --git a/src/addon/mod/choice/providers/choice.ts b/src/addon/mod/choice/providers/choice.ts
index a26b6be29..b94fec312 100644
--- a/src/addon/mod/choice/providers/choice.ts
+++ b/src/addon/mod/choice/providers/choice.ts
@@ -31,6 +31,9 @@ export class AddonModChoiceProvider {
static RESULTS_AFTER_CLOSE = 2;
static RESULTS_ALWAYS = 3;
+ static PUBLISH_ANONYMOUS = false;
+ static PUBLISH_NAMES = true;
+
protected ROOT_CACHE_KEY = 'mmaModChoice:';
constructor(private sitesProvider: CoreSitesProvider, private appProvider: CoreAppProvider,