MOBILE-4616 feedback: Move feedback constants to a file

main
Pau Ferrer Ocaña 2024-07-11 22:40:27 +02:00
parent bc1e3f00e7
commit 4934dcec99
16 changed files with 118 additions and 88 deletions

View File

@ -16,13 +16,13 @@ import { CoreRoutedItemsManagerSource } from '@classes/items-management/routed-i
import { CoreGroupInfo, CoreGroups } from '@services/groups'; import { CoreGroupInfo, CoreGroups } from '@services/groups';
import { import {
AddonModFeedback, AddonModFeedback,
AddonModFeedbackProvider,
AddonModFeedbackWSAnonAttempt, AddonModFeedbackWSAnonAttempt,
AddonModFeedbackWSAttempt, AddonModFeedbackWSAttempt,
AddonModFeedbackWSFeedback, AddonModFeedbackWSFeedback,
} from '../services/feedback'; } from '../services/feedback';
import { AddonModFeedbackHelper } from '../services/feedback-helper'; import { AddonModFeedbackHelper } from '../services/feedback-helper';
import { Params } from '@angular/router'; import { Params } from '@angular/router';
import { ADDON_MOD_FEEDBACK_PER_PAGE } from '../constants';
/** /**
* Feedback attempts. * Feedback attempts.
@ -120,7 +120,7 @@ export class AddonModFeedbackAttemptsSource extends CoreRoutedItemsManagerSource
* @inheritdoc * @inheritdoc
*/ */
protected getPageLength(): number { protected getPageLength(): number {
return AddonModFeedbackProvider.PER_PAGE; return ADDON_MOD_FEEDBACK_PER_PAGE;
} }
/** /**
@ -146,10 +146,10 @@ export class AddonModFeedbackAttemptsSource extends CoreRoutedItemsManagerSource
const pageAttempts: AddonModFeedbackAttemptItem[] = [ const pageAttempts: AddonModFeedbackAttemptItem[] = [
// The page argument is ignored in the webservice when there is only one page, // The page argument is ignored in the webservice when there is only one page,
// so we should ignore the responses of pages beyond the first if that's the case. // so we should ignore the responses of pages beyond the first if that's the case.
...(page === 0 || result.totalattempts > AddonModFeedbackProvider.PER_PAGE) ...(page === 0 || result.totalattempts > ADDON_MOD_FEEDBACK_PER_PAGE)
? result.attempts ? result.attempts
: [], : [],
...(page === 0 || result.totalanonattempts > AddonModFeedbackProvider.PER_PAGE) ...(page === 0 || result.totalanonattempts > ADDON_MOD_FEEDBACK_PER_PAGE)
? result.anonattempts ? result.anonattempts
: [], : [],
]; ];

View File

@ -27,7 +27,6 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { import {
AddonModFeedback, AddonModFeedback,
AddonModFeedbackGetFeedbackAccessInformationWSResponse, AddonModFeedbackGetFeedbackAccessInformationWSResponse,
AddonModFeedbackProvider,
AddonModFeedbackWSFeedback, AddonModFeedbackWSFeedback,
AddonModFeedbackWSItem, AddonModFeedbackWSItem,
} from '../../services/feedback'; } from '../../services/feedback';
@ -38,8 +37,8 @@ import {
AddonModFeedbackSyncProvider, AddonModFeedbackSyncProvider,
AddonModFeedbackSyncResult, AddonModFeedbackSyncResult,
} from '../../services/feedback-sync'; } from '../../services/feedback-sync';
import { AddonModFeedbackModuleHandlerService } from '../../services/handlers/module';
import { AddonModFeedbackPrefetchHandler } from '../../services/handlers/prefetch'; import { AddonModFeedbackPrefetchHandler } from '../../services/handlers/prefetch';
import { ADDON_MOD_FEEDBACK_COMPONENT, ADDON_MOD_FEEDBACK_FORM_SUBMITTED, ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
/** /**
* Component that displays a feedback index page. * Component that displays a feedback index page.
@ -55,7 +54,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
@Input() tab = 'overview'; @Input() tab = 'overview';
@Input() group = 0; @Input() group = 0;
component = AddonModFeedbackProvider.COMPONENT; component = ADDON_MOD_FEEDBACK_COMPONENT;
pluginName = 'feedback'; pluginName = 'feedback';
feedback?: AddonModFeedbackWSFeedback; feedback?: AddonModFeedbackWSFeedback;
goPage?: number; goPage?: number;
@ -92,7 +91,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
super('AddonModLessonIndexComponent', content, courseContentsPage); super('AddonModLessonIndexComponent', content, courseContentsPage);
// Listen for form submit events. // Listen for form submit events.
this.submitObserver = CoreEvents.on(AddonModFeedbackProvider.FORM_SUBMITTED, async (data) => { this.submitObserver = CoreEvents.on(ADDON_MOD_FEEDBACK_FORM_SUBMITTED, async (data) => {
if (!this.feedback || data.feedbackId != this.feedback.id) { if (!this.feedback || data.feedbackId != this.feedback.id) {
return; return;
} }
@ -374,7 +373,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
*/ */
gotoAnswerQuestions(preview: boolean = false): void { gotoAnswerQuestions(preview: boolean = false): void {
CoreNavigator.navigateToSitePath( CoreNavigator.navigateToSitePath(
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${this.courseId}/${this.module.id}/form`, ADDON_MOD_FEEDBACK_PAGE_NAME + `/${this.courseId}/${this.module.id}/form`,
{ {
params: { params: {
preview, preview,
@ -407,7 +406,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
*/ */
openNonRespondents(): void { openNonRespondents(): void {
CoreNavigator.navigateToSitePath( CoreNavigator.navigateToSitePath(
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${this.courseId}/${this.module.id}/nonrespondents`, ADDON_MOD_FEEDBACK_PAGE_NAME + `/${this.courseId}/${this.module.id}/nonrespondents`,
{ {
params: { params: {
group: this.group, group: this.group,
@ -425,7 +424,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
} }
CoreNavigator.navigateToSitePath( CoreNavigator.navigateToSitePath(
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${this.courseId}/${this.module.id}/attempts`, ADDON_MOD_FEEDBACK_PAGE_NAME + `/${this.courseId}/${this.module.id}/attempts`,
{ {
params: { params: {
group: this.group, group: this.group,

View File

@ -0,0 +1,26 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export const ADDON_MOD_FEEDBACK_COMPONENT = 'mmaModFeedback';
export const ADDON_MOD_FEEDBACK_PAGE_NAME = 'mod_feedback';
export const ADDON_MOD_FEEDBACK_FORM_SUBMITTED = 'addon_mod_feedback_form_submitted';
export const ADDON_MOD_FEEDBACK_LINE_SEP = '|';
export const ADDON_MOD_FEEDBACK_MULTICHOICE_TYPE_SEP = '>>>>>';
export const ADDON_MOD_FEEDBACK_MULTICHOICE_ADJUST_SEP = '<<<<<';
export const ADDON_MOD_FEEDBACK_MULTICHOICE_HIDENOSELECT = 'h';
export const ADDON_MOD_FEEDBACK_MULTICHOICERATED_VALUE_SEP = '####';
export const ADDON_MOD_FEEDBACK_PER_PAGE = 20;

View File

@ -86,4 +86,4 @@ const routes: Routes = [
AddonModFeedbackAttemptPage, AddonModFeedbackAttemptPage,
], ],
}) })
export class AddonModFeedbackLazyModule {} export default class AddonModFeedbackLazyModule {}

View File

@ -23,23 +23,23 @@ import { CorePushNotificationsDelegate } from '@features/pushnotifications/servi
import { CoreCronDelegate } from '@services/cron'; import { CoreCronDelegate } from '@services/cron';
import { CORE_SITE_SCHEMAS } from '@services/sites'; import { CORE_SITE_SCHEMAS } from '@services/sites';
import { OFFLINE_SITE_SCHEMA } from './services/database/feedback'; import { OFFLINE_SITE_SCHEMA } from './services/database/feedback';
import { AddonModFeedbackProvider } from './services/feedback';
import { AddonModFeedbackAnalysisLinkHandler } from './services/handlers/analysis-link'; import { AddonModFeedbackAnalysisLinkHandler } from './services/handlers/analysis-link';
import { AddonModFeedbackCompleteLinkHandler } from './services/handlers/complete-link'; import { AddonModFeedbackCompleteLinkHandler } from './services/handlers/complete-link';
import { AddonModFeedbackIndexLinkHandler } from './services/handlers/index-link'; import { AddonModFeedbackIndexLinkHandler } from './services/handlers/index-link';
import { AddonModFeedbackListLinkHandler } from './services/handlers/list-link'; import { AddonModFeedbackListLinkHandler } from './services/handlers/list-link';
import { AddonModFeedbackModuleHandlerService, AddonModFeedbackModuleHandler } from './services/handlers/module'; import { AddonModFeedbackModuleHandler } from './services/handlers/module';
import { AddonModFeedbackPrefetchHandler } from './services/handlers/prefetch'; import { AddonModFeedbackPrefetchHandler } from './services/handlers/prefetch';
import { AddonModFeedbackPrintLinkHandler } from './services/handlers/print-link'; import { AddonModFeedbackPrintLinkHandler } from './services/handlers/print-link';
import { AddonModFeedbackPushClickHandler } from './services/handlers/push-click'; import { AddonModFeedbackPushClickHandler } from './services/handlers/push-click';
import { AddonModFeedbackShowEntriesLinkHandler } from './services/handlers/show-entries-link'; import { AddonModFeedbackShowEntriesLinkHandler } from './services/handlers/show-entries-link';
import { AddonModFeedbackShowNonRespondentsLinkHandler } from './services/handlers/show-non-respondents-link'; import { AddonModFeedbackShowNonRespondentsLinkHandler } from './services/handlers/show-non-respondents-link';
import { AddonModFeedbackSyncCronHandler } from './services/handlers/sync-cron'; import { AddonModFeedbackSyncCronHandler } from './services/handlers/sync-cron';
import { ADDON_MOD_FEEDBACK_COMPONENT, ADDON_MOD_FEEDBACK_PAGE_NAME } from './constants';
const routes: Routes = [ const routes: Routes = [
{ {
path: AddonModFeedbackModuleHandlerService.PAGE_NAME, path: ADDON_MOD_FEEDBACK_PAGE_NAME,
loadChildren: () => import('./feedback-lazy.module').then(m => m.AddonModFeedbackLazyModule), loadChildren: () => import('./feedback-lazy.module'),
}, },
]; ];
@ -69,7 +69,7 @@ const routes: Routes = [
CoreContentLinksDelegate.registerHandler(AddonModFeedbackShowNonRespondentsLinkHandler.instance); CoreContentLinksDelegate.registerHandler(AddonModFeedbackShowNonRespondentsLinkHandler.instance);
CorePushNotificationsDelegate.registerClickHandler(AddonModFeedbackPushClickHandler.instance); CorePushNotificationsDelegate.registerClickHandler(AddonModFeedbackPushClickHandler.instance);
CoreCourseHelper.registerModuleReminderClick(AddonModFeedbackProvider.COMPONENT); CoreCourseHelper.registerModuleReminderClick(ADDON_MOD_FEEDBACK_COMPONENT);
}, },
}, },
], ],

View File

@ -22,13 +22,13 @@ import { CoreTextUtils } from '@services/utils/text';
import { AddonModFeedbackAttemptsSource } from '../../classes/feedback-attempts-source'; import { AddonModFeedbackAttemptsSource } from '../../classes/feedback-attempts-source';
import { import {
AddonModFeedback, AddonModFeedback,
AddonModFeedbackProvider,
AddonModFeedbackWSAnonAttempt, AddonModFeedbackWSAnonAttempt,
AddonModFeedbackWSFeedback, AddonModFeedbackWSFeedback,
} from '../../services/feedback'; } from '../../services/feedback';
import { AddonModFeedbackAttempt, AddonModFeedbackFormItem, AddonModFeedbackHelper } from '../../services/feedback-helper'; import { AddonModFeedbackAttempt, AddonModFeedbackFormItem, AddonModFeedbackHelper } from '../../services/feedback-helper';
import { CoreTime } from '@singletons/time'; import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_FEEDBACK_COMPONENT } from '../../constants';
/** /**
* Page that displays a feedback attempt review. * Page that displays a feedback attempt review.
@ -46,7 +46,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy {
attempts: AddonModFeedbackAttemptsSwipeManager; attempts: AddonModFeedbackAttemptsSwipeManager;
anonAttempt?: AddonModFeedbackWSAnonAttempt; anonAttempt?: AddonModFeedbackWSAnonAttempt;
items: AddonModFeedbackAttemptItem[] = []; items: AddonModFeedbackAttemptItem[] = [];
component = AddonModFeedbackProvider.COMPONENT; component = ADDON_MOD_FEEDBACK_COMPONENT;
loaded = false; loaded = false;
protected attemptId: number; protected attemptId: number;

View File

@ -30,14 +30,13 @@ import {
AddonModFeedback, AddonModFeedback,
AddonModFeedbackGetFeedbackAccessInformationWSResponse, AddonModFeedbackGetFeedbackAccessInformationWSResponse,
AddonModFeedbackPageItems, AddonModFeedbackPageItems,
AddonModFeedbackProvider,
AddonModFeedbackResponseValue, AddonModFeedbackResponseValue,
AddonModFeedbackWSFeedback, AddonModFeedbackWSFeedback,
} from '../../services/feedback'; } from '../../services/feedback';
import { AddonModFeedbackFormItem, AddonModFeedbackHelper } from '../../services/feedback-helper'; import { AddonModFeedbackFormItem, AddonModFeedbackHelper } from '../../services/feedback-helper';
import { AddonModFeedbackSync } from '../../services/feedback-sync'; import { AddonModFeedbackSync } from '../../services/feedback-sync';
import { AddonModFeedbackModuleHandlerService } from '../../services/handlers/module';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_FEEDBACK_COMPONENT, ADDON_MOD_FEEDBACK_FORM_SUBMITTED, ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
/** /**
* Page that displays feedback form. * Page that displays feedback form.
@ -65,7 +64,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
courseId!: number; courseId!: number;
feedback?: AddonModFeedbackWSFeedback; feedback?: AddonModFeedbackWSFeedback;
completionPageContents?: string; completionPageContents?: string;
component = AddonModFeedbackProvider.COMPONENT; component = ADDON_MOD_FEEDBACK_COMPONENT;
offline = false; offline = false;
feedbackLoaded = false; feedbackLoaded = false;
access?: AddonModFeedbackGetFeedbackAccessInformationWSResponse; access?: AddonModFeedbackGetFeedbackAccessInformationWSResponse;
@ -356,7 +355,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
]); ]);
// If form has been submitted, the info has been already invalidated but we should update index view. // If form has been submitted, the info has been already invalidated but we should update index view.
CoreEvents.trigger(AddonModFeedbackProvider.FORM_SUBMITTED, { CoreEvents.trigger(ADDON_MOD_FEEDBACK_FORM_SUBMITTED, {
feedbackId: this.feedback!.id, feedbackId: this.feedback!.id,
tab: 'overview', tab: 'overview',
offline: this.completedOffline, offline: this.completedOffline,
@ -373,7 +372,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
// Invalidate access information so user will see home page updated (continue form). // Invalidate access information so user will see home page updated (continue form).
await AddonModFeedback.invalidateResumePageData(this.feedback!.id); await AddonModFeedback.invalidateResumePageData(this.feedback!.id);
CoreEvents.trigger(AddonModFeedbackProvider.FORM_SUBMITTED, { CoreEvents.trigger(ADDON_MOD_FEEDBACK_FORM_SUBMITTED, {
feedbackId: this.feedback!.id, feedbackId: this.feedback!.id,
tab: 'overview', tab: 'overview',
offline: this.completedOffline, offline: this.completedOffline,
@ -395,7 +394,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
showAnalysis(): void { showAnalysis(): void {
if (this.fromIndex) { if (this.fromIndex) {
// Previous page is the index page, go back. // Previous page is the index page, go back.
CoreEvents.trigger(AddonModFeedbackProvider.FORM_SUBMITTED, { CoreEvents.trigger(ADDON_MOD_FEEDBACK_FORM_SUBMITTED, {
feedbackId: this.feedback!.id, feedbackId: this.feedback!.id,
tab: 'analysis', tab: 'analysis',
offline: this.completedOffline, offline: this.completedOffline,
@ -406,7 +405,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
return; return;
} }
CoreNavigator.navigateToSitePath(AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${this.courseId}/${this.cmId}`, { CoreNavigator.navigateToSitePath(ADDON_MOD_FEEDBACK_PAGE_NAME + `/${this.courseId}/${this.cmId}`, {
params: { params: {
module: this.module, module: this.module,
tab: 'analysis', tab: 'analysis',

View File

@ -28,12 +28,18 @@ import {
AddonModFeedbackGetResponsesAnalysisWSResponse, AddonModFeedbackGetResponsesAnalysisWSResponse,
AddonModFeedbackGroupPaginatedOptions, AddonModFeedbackGroupPaginatedOptions,
AddonModFeedbackItem, AddonModFeedbackItem,
AddonModFeedbackProvider,
AddonModFeedbackResponseValue, AddonModFeedbackResponseValue,
AddonModFeedbackWSAttempt, AddonModFeedbackWSAttempt,
AddonModFeedbackWSNonRespondent, AddonModFeedbackWSNonRespondent,
} from './feedback'; } from './feedback';
import { AddonModFeedbackModuleHandlerService } from './handlers/module'; import {
ADDON_MOD_FEEDBACK_LINE_SEP,
ADDON_MOD_FEEDBACK_MULTICHOICE_TYPE_SEP,
ADDON_MOD_FEEDBACK_MULTICHOICE_ADJUST_SEP,
ADDON_MOD_FEEDBACK_MULTICHOICERATED_VALUE_SEP,
ADDON_MOD_FEEDBACK_MULTICHOICE_HIDENOSELECT,
ADDON_MOD_FEEDBACK_PAGE_NAME,
} from '../constants';
const MODE_RESPONSETIME = 1; const MODE_RESPONSETIME = 1;
const MODE_COURSE = 2; const MODE_COURSE = 2;
@ -184,7 +190,7 @@ export class AddonModFeedbackHelperProvider {
if (params.showcompleted === undefined) { if (params.showcompleted === undefined) {
// Param showcompleted not defined. Show entry list. // Param showcompleted not defined. Show entry list.
await CoreNavigator.navigateToSitePath( await CoreNavigator.navigateToSitePath(
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/attempts`, ADDON_MOD_FEEDBACK_PAGE_NAME + `/${module.course}/${module.id}/attempts`,
{ siteId }, { siteId },
); );
@ -198,7 +204,7 @@ export class AddonModFeedbackHelperProvider {
}); });
await CoreNavigator.navigateToSitePath( await CoreNavigator.navigateToSitePath(
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/attempts/${attempt.id}`, ADDON_MOD_FEEDBACK_PAGE_NAME + `/${module.course}/${module.id}/attempts/${attempt.id}`,
{ {
params: { params: {
feedbackId: module.instance, feedbackId: module.instance,
@ -295,7 +301,7 @@ export class AddonModFeedbackHelperProvider {
*/ */
protected getItemFormNumeric(item: AddonModFeedbackItem): AddonModFeedbackNumericItem { protected getItemFormNumeric(item: AddonModFeedbackItem): AddonModFeedbackNumericItem {
const range = item.presentation.split(AddonModFeedbackProvider.LINE_SEP) || []; const range = item.presentation.split(ADDON_MOD_FEEDBACK_LINE_SEP) || [];
const rangeFrom = range.length > 0 ? parseInt(range[0], 10) : undefined; const rangeFrom = range.length > 0 ? parseInt(range[0], 10) : undefined;
const rangeTo = range.length > 1 ? parseInt(range[1], 10) : undefined; const rangeTo = range.length > 1 ? parseInt(range[1], 10) : undefined;
@ -320,7 +326,7 @@ export class AddonModFeedbackHelperProvider {
protected getItemFormTextfield(item: AddonModFeedbackItem): AddonModFeedbackTextItem { protected getItemFormTextfield(item: AddonModFeedbackItem): AddonModFeedbackTextItem {
return Object.assign(item, { return Object.assign(item, {
templateName: 'textfield', templateName: 'textfield',
length: Number(item.presentation.split(AddonModFeedbackProvider.LINE_SEP)[1]) || 255, length: Number(item.presentation.split(ADDON_MOD_FEEDBACK_LINE_SEP)[1]) || 255,
value: item.rawValue !== undefined ? item.rawValue : '', value: item.rawValue !== undefined ? item.rawValue : '',
slottedLabel: true, slottedLabel: true,
}); });
@ -348,7 +354,7 @@ export class AddonModFeedbackHelperProvider {
*/ */
protected getItemFormMultichoice(item: AddonModFeedbackItem): AddonModFeedbackMultichoiceItem { protected getItemFormMultichoice(item: AddonModFeedbackItem): AddonModFeedbackMultichoiceItem {
let parts = item.presentation.split(AddonModFeedbackProvider.MULTICHOICE_TYPE_SEP) || []; let parts = item.presentation.split(ADDON_MOD_FEEDBACK_MULTICHOICE_TYPE_SEP) || [];
const subType = parts.length > 0 && parts[0] ? parts[0] : 'r'; const subType = parts.length > 0 && parts[0] ? parts[0] : 'r';
const formItem: AddonModFeedbackMultichoiceItem = Object.assign(item, { const formItem: AddonModFeedbackMultichoiceItem = Object.assign(item, {
@ -361,20 +367,20 @@ export class AddonModFeedbackHelperProvider {
formItem.presentation = parts.length > 1 ? parts[1] : ''; formItem.presentation = parts.length > 1 ? parts[1] : '';
if (formItem.subtype != 'd') { if (formItem.subtype != 'd') {
parts = formItem.presentation.split(AddonModFeedbackProvider.MULTICHOICE_ADJUST_SEP) || []; parts = formItem.presentation.split(ADDON_MOD_FEEDBACK_MULTICHOICE_ADJUST_SEP) || [];
formItem.presentation = parts.length > 0 ? parts[0] : ''; formItem.presentation = parts.length > 0 ? parts[0] : '';
// Horizontal are not supported right now. item.horizontal = parts.length > 1 && !!parts[1]; // Horizontal are not supported right now. item.horizontal = parts.length > 1 && !!parts[1];
} }
const choices = formItem.presentation.split(AddonModFeedbackProvider.LINE_SEP) || []; const choices = formItem.presentation.split(ADDON_MOD_FEEDBACK_LINE_SEP) || [];
formItem.choices = choices.map((choice, index) => { formItem.choices = choices.map((choice, index) => {
const weightValue = choice.split(AddonModFeedbackProvider.MULTICHOICERATED_VALUE_SEP) || ['']; const weightValue = choice.split(ADDON_MOD_FEEDBACK_MULTICHOICERATED_VALUE_SEP) || [''];
choice = weightValue.length == 1 ? weightValue[0] : '(' + weightValue[0] + ') ' + weightValue[1]; choice = weightValue.length == 1 ? weightValue[0] : '(' + weightValue[0] + ') ' + weightValue[1];
return { value: index + 1, label: choice }; return { value: index + 1, label: choice };
}); });
if (formItem.subtype === 'r' && formItem.options.search(AddonModFeedbackProvider.MULTICHOICE_HIDENOSELECT) == -1) { if (formItem.subtype === 'r' && formItem.options.search(ADDON_MOD_FEEDBACK_MULTICHOICE_HIDENOSELECT) == -1) {
formItem.choices.unshift({ value: 0, label: Translate.instant('addon.mod_feedback.not_selected') }); formItem.choices.unshift({ value: 0, label: Translate.instant('addon.mod_feedback.not_selected') });
formItem.value = formItem.rawValue !== undefined ? Number(formItem.rawValue) : 0; formItem.value = formItem.rawValue !== undefined ? Number(formItem.rawValue) : 0;
} else if (formItem.subtype === 'd') { } else if (formItem.subtype === 'd') {
@ -383,7 +389,7 @@ export class AddonModFeedbackHelperProvider {
} else if (formItem.subtype === 'c') { } else if (formItem.subtype === 'c') {
if (formItem.rawValue !== undefined) { if (formItem.rawValue !== undefined) {
formItem.rawValue = String(formItem.rawValue); formItem.rawValue = String(formItem.rawValue);
const values = formItem.rawValue.split(AddonModFeedbackProvider.LINE_SEP); const values = formItem.rawValue.split(ADDON_MOD_FEEDBACK_LINE_SEP);
formItem.choices.forEach((choice) => { formItem.choices.forEach((choice) => {
for (const x in values) { for (const x in values) {
if (choice.value == Number(values[x])) { if (choice.value == Number(values[x])) {

View File

@ -24,9 +24,10 @@ import { CoreSync, CoreSyncResult } from '@services/sync';
import { CoreUtils } from '@services/utils/utils'; import { CoreUtils } from '@services/utils/utils';
import { makeSingleton, Translate } from '@singletons'; import { makeSingleton, Translate } from '@singletons';
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
import { AddonModFeedback, AddonModFeedbackProvider, AddonModFeedbackWSFeedback } from './feedback'; import { AddonModFeedback, AddonModFeedbackWSFeedback } from './feedback';
import { AddonModFeedbackOffline, AddonModFeedbackOfflineResponse } from './feedback-offline'; import { AddonModFeedbackOffline, AddonModFeedbackOfflineResponse } from './feedback-offline';
import { AddonModFeedbackPrefetchHandler, AddonModFeedbackPrefetchHandlerService } from './handlers/prefetch'; import { AddonModFeedbackPrefetchHandler, AddonModFeedbackPrefetchHandlerService } from './handlers/prefetch';
import { ADDON_MOD_FEEDBACK_COMPONENT } from '../constants';
/** /**
* Service to sync feedbacks. * Service to sync feedbacks.
@ -137,7 +138,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv
} }
// Verify that feedback isn't blocked. // Verify that feedback isn't blocked.
if (CoreSync.isBlocked(AddonModFeedbackProvider.COMPONENT, feedbackId, siteId)) { if (CoreSync.isBlocked(ADDON_MOD_FEEDBACK_COMPONENT, feedbackId, siteId)) {
this.logger.debug(`Cannot sync feedback '${feedbackId}' because it is blocked.`); this.logger.debug(`Cannot sync feedback '${feedbackId}' because it is blocked.`);
throw new CoreSyncBlockedError(Translate.instant('core.errorsyncblocked', { $a: this.componentTranslate })); throw new CoreSyncBlockedError(Translate.instant('core.errorsyncblocked', { $a: this.componentTranslate }));
@ -162,7 +163,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv
}; };
// Sync offline logs. // Sync offline logs.
await CoreUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(AddonModFeedbackProvider.COMPONENT, feedbackId, siteId)); await CoreUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(ADDON_MOD_FEEDBACK_COMPONENT, feedbackId, siteId));
// Get offline responses to be sent. // Get offline responses to be sent.
const responses = await CoreUtils.ignoreErrors(AddonModFeedbackOffline.getFeedbackResponses(feedbackId, siteId)); const responses = await CoreUtils.ignoreErrors(AddonModFeedbackOffline.getFeedbackResponses(feedbackId, siteId));

View File

@ -26,8 +26,15 @@ import { makeSingleton, Translate } from '@singletons';
import { AddonModFeedbackOffline } from './feedback-offline'; import { AddonModFeedbackOffline } from './feedback-offline';
import { AddonModFeedbackAutoSyncData, AddonModFeedbackSyncProvider } from './feedback-sync'; import { AddonModFeedbackAutoSyncData, AddonModFeedbackSyncProvider } from './feedback-sync';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site'; import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import {
const ROOT_CACHE_KEY = 'AddonModFeedback:'; ADDON_MOD_FEEDBACK_COMPONENT,
ADDON_MOD_FEEDBACK_FORM_SUBMITTED,
ADDON_MOD_FEEDBACK_LINE_SEP,
ADDON_MOD_FEEDBACK_MULTICHOICE_ADJUST_SEP,
ADDON_MOD_FEEDBACK_MULTICHOICE_TYPE_SEP,
ADDON_MOD_FEEDBACK_MULTICHOICERATED_VALUE_SEP,
ADDON_MOD_FEEDBACK_PER_PAGE,
} from '../constants';
/** /**
* Service that provides some features for feedbacks. * Service that provides some features for feedbacks.
@ -35,14 +42,7 @@ const ROOT_CACHE_KEY = 'AddonModFeedback:';
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class AddonModFeedbackProvider { export class AddonModFeedbackProvider {
static readonly COMPONENT = 'mmaModFeedback'; protected static readonly ROOT_CACHE_KEY = 'AddonModFeedback:';
static readonly FORM_SUBMITTED = 'addon_mod_feedback_form_submitted';
static readonly LINE_SEP = '|';
static readonly MULTICHOICE_TYPE_SEP = '>>>>>';
static readonly MULTICHOICE_ADJUST_SEP = '<<<<<';
static readonly MULTICHOICE_HIDENOSELECT = 'h';
static readonly MULTICHOICERATED_VALUE_SEP = '####';
static readonly PER_PAGE = 20;
/** /**
* Check dependency of a question item. * Check dependency of a question item.
@ -80,11 +80,11 @@ export class AddonModFeedbackProvider {
* @returns Return true if dependency is acomplished and it can be shown. False, otherwise. * @returns Return true if dependency is acomplished and it can be shown. False, otherwise.
*/ */
protected compareDependItemMultichoice(item: AddonModFeedbackItem, dependValue: string): boolean { protected compareDependItemMultichoice(item: AddonModFeedbackItem, dependValue: string): boolean {
const parts = item.presentation.split(AddonModFeedbackProvider.MULTICHOICE_TYPE_SEP) || []; const parts = item.presentation.split(ADDON_MOD_FEEDBACK_MULTICHOICE_TYPE_SEP) || [];
const subtype = parts.length > 0 && parts[0] ? parts[0] : 'r'; const subtype = parts.length > 0 && parts[0] ? parts[0] : 'r';
const choicesStr = (parts[1] || '').split(AddonModFeedbackProvider.MULTICHOICE_ADJUST_SEP)[0] || ''; const choicesStr = (parts[1] || '').split(ADDON_MOD_FEEDBACK_MULTICHOICE_ADJUST_SEP)[0] || '';
const choices = choicesStr.split(AddonModFeedbackProvider.LINE_SEP) || []; const choices = choicesStr.split(ADDON_MOD_FEEDBACK_LINE_SEP) || [];
let values: AddonModFeedbackResponseValue[]; let values: AddonModFeedbackResponseValue[];
if (subtype === 'c') { if (subtype === 'c') {
@ -92,7 +92,7 @@ export class AddonModFeedbackProvider {
values = ['']; values = [''];
} else { } else {
item.rawValue = '' + item.rawValue; item.rawValue = '' + item.rawValue;
values = item.rawValue.split(AddonModFeedbackProvider.LINE_SEP); values = item.rawValue.split(ADDON_MOD_FEEDBACK_LINE_SEP);
} }
} else { } else {
values = [item.rawValue || '']; values = [item.rawValue || ''];
@ -104,7 +104,7 @@ export class AddonModFeedbackProvider {
let value = choices[index]; let value = choices[index];
if (item.typ == 'multichoicerated') { if (item.typ == 'multichoicerated') {
value = value.split(AddonModFeedbackProvider.MULTICHOICERATED_VALUE_SEP)[1] || ''; value = value.split(ADDON_MOD_FEEDBACK_MULTICHOICERATED_VALUE_SEP)[1] || '';
} }
if (value.trim() == dependValue) { if (value.trim() == dependValue) {
@ -195,10 +195,10 @@ export class AddonModFeedbackProvider {
} }
// Treat multichoice checkboxes. // Treat multichoice checkboxes.
if (item.typ === 'multichoice' && item.presentation.split(AddonModFeedbackProvider.MULTICHOICE_TYPE_SEP)[0] === 'c') { if (item.typ === 'multichoice' && item.presentation.split(ADDON_MOD_FEEDBACK_MULTICHOICE_TYPE_SEP)[0] === 'c') {
offlineValues[item.id] = offlineValues[item.id].filter((value) => Number(value) > 0); offlineValues[item.id] = offlineValues[item.id].filter((value) => Number(value) > 0);
item.rawValue = offlineValues[item.id].join(AddonModFeedbackProvider.LINE_SEP); item.rawValue = offlineValues[item.id].join(ADDON_MOD_FEEDBACK_LINE_SEP);
} else { } else {
item.rawValue = offlineValues[item.id][0]; item.rawValue = offlineValues[item.id][0];
} }
@ -314,7 +314,7 @@ export class AddonModFeedbackProvider {
}; };
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAnalysisDataCacheKey(feedbackId, options.groupId), cacheKey: this.getAnalysisDataCacheKey(feedbackId, options.groupId),
component: AddonModFeedbackProvider.COMPONENT, component: ADDON_MOD_FEEDBACK_COMPONENT,
componentId: options.cmId, componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -429,7 +429,7 @@ export class AddonModFeedbackProvider {
}; };
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCurrentCompletedTimeModifiedDataCacheKey(feedbackId), cacheKey: this.getCurrentCompletedTimeModifiedDataCacheKey(feedbackId),
component: AddonModFeedbackProvider.COMPONENT, component: ADDON_MOD_FEEDBACK_COMPONENT,
componentId: options.cmId, componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -476,7 +476,7 @@ export class AddonModFeedbackProvider {
}; };
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCurrentValuesDataCacheKey(feedbackId), cacheKey: this.getCurrentValuesDataCacheKey(feedbackId),
component: AddonModFeedbackProvider.COMPONENT, component: ADDON_MOD_FEEDBACK_COMPONENT,
componentId: options.cmId, componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -529,7 +529,7 @@ export class AddonModFeedbackProvider {
}; };
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getFeedbackAccessInformationDataCacheKey(feedbackId), cacheKey: this.getFeedbackAccessInformationDataCacheKey(feedbackId),
component: AddonModFeedbackProvider.COMPONENT, component: ADDON_MOD_FEEDBACK_COMPONENT,
componentId: options.cmId, componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -554,7 +554,7 @@ export class AddonModFeedbackProvider {
* @returns Cache key. * @returns Cache key.
*/ */
protected getFeedbackCacheKey(courseId: number): string { protected getFeedbackCacheKey(courseId: number): string {
return ROOT_CACHE_KEY + 'feedback:' + courseId; return AddonModFeedbackProvider.ROOT_CACHE_KEY + 'feedback:' + courseId;
} }
/** /**
@ -564,7 +564,7 @@ export class AddonModFeedbackProvider {
* @returns Cache key. * @returns Cache key.
*/ */
protected getFeedbackDataPrefixCacheKey(feedbackId: number): string { protected getFeedbackDataPrefixCacheKey(feedbackId: number): string {
return ROOT_CACHE_KEY + feedbackId; return AddonModFeedbackProvider.ROOT_CACHE_KEY + feedbackId;
} }
/** /**
@ -590,7 +590,7 @@ export class AddonModFeedbackProvider {
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getFeedbackCacheKey(courseId), cacheKey: this.getFeedbackCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY, updateFrequency: CoreSite.FREQUENCY_RARELY,
component: AddonModFeedbackProvider.COMPONENT, component: ADDON_MOD_FEEDBACK_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -648,7 +648,7 @@ export class AddonModFeedbackProvider {
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getItemsDataCacheKey(feedbackId), cacheKey: this.getItemsDataCacheKey(feedbackId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES, updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
component: AddonModFeedbackProvider.COMPONENT, component: ADDON_MOD_FEEDBACK_COMPONENT,
componentId: options.cmId, componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -686,11 +686,11 @@ export class AddonModFeedbackProvider {
feedbackid: feedbackId, feedbackid: feedbackId,
groupid: options.groupId, groupid: options.groupId,
page: options.page, page: options.page,
perpage: AddonModFeedbackProvider.PER_PAGE, perpage: ADDON_MOD_FEEDBACK_PER_PAGE,
}; };
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getNonRespondentsDataCacheKey(feedbackId, options.groupId), cacheKey: this.getNonRespondentsDataCacheKey(feedbackId, options.groupId),
component: AddonModFeedbackProvider.COMPONENT, component: ADDON_MOD_FEEDBACK_COMPONENT,
componentId: options.cmId, componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -862,11 +862,11 @@ export class AddonModFeedbackProvider {
feedbackid: feedbackId, feedbackid: feedbackId,
groupid: options.groupId, groupid: options.groupId,
page: options.page, page: options.page,
perpage: AddonModFeedbackProvider.PER_PAGE, perpage: ADDON_MOD_FEEDBACK_PER_PAGE,
}; };
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getResponsesAnalysisDataCacheKey(feedbackId, options.groupId), cacheKey: this.getResponsesAnalysisDataCacheKey(feedbackId, options.groupId),
component: AddonModFeedbackProvider.COMPONENT, component: ADDON_MOD_FEEDBACK_COMPONENT,
componentId: options.cmId, componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -910,7 +910,7 @@ export class AddonModFeedbackProvider {
}; };
const preSets = { const preSets = {
cacheKey: this.getResumePageDataCacheKey(feedbackId), cacheKey: this.getResumePageDataCacheKey(feedbackId),
component: AddonModFeedbackProvider.COMPONENT, component: ADDON_MOD_FEEDBACK_COMPONENT,
componentId: options.cmId, componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -1024,7 +1024,7 @@ export class AddonModFeedbackProvider {
* @returns Promise resolved when the files are invalidated. * @returns Promise resolved when the files are invalidated.
*/ */
async invalidateFiles(moduleId: number, siteId?: string): Promise<void> { async invalidateFiles(moduleId: number, siteId?: string): Promise<void> {
return CoreFilepool.invalidateFilesByComponent(siteId, AddonModFeedbackProvider.COMPONENT, moduleId); return CoreFilepool.invalidateFilesByComponent(siteId, ADDON_MOD_FEEDBACK_COMPONENT, moduleId);
} }
/** /**
@ -1082,7 +1082,7 @@ export class AddonModFeedbackProvider {
const preSets: CoreSiteWSPreSets = { const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCompletedDataCacheKey(feedbackId), cacheKey: this.getCompletedDataCacheKey(feedbackId),
updateFrequency: CoreSite.FREQUENCY_RARELY, updateFrequency: CoreSite.FREQUENCY_RARELY,
component: AddonModFeedbackProvider.COMPONENT, component: ADDON_MOD_FEEDBACK_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets. ...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
}; };
@ -1106,7 +1106,7 @@ export class AddonModFeedbackProvider {
await CoreCourseLogHelper.log( await CoreCourseLogHelper.log(
'mod_feedback_view_feedback', 'mod_feedback_view_feedback',
params, params,
AddonModFeedbackProvider.COMPONENT, ADDON_MOD_FEEDBACK_COMPONENT,
id, id,
siteId, siteId,
); );
@ -1252,7 +1252,7 @@ declare module '@singletons/events' {
* @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation * @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
*/ */
export interface CoreEventsData { export interface CoreEventsData {
[AddonModFeedbackProvider.FORM_SUBMITTED]: AddonModFeedbackFormSubmittedData; [ADDON_MOD_FEEDBACK_FORM_SUBMITTED]: AddonModFeedbackFormSubmittedData;
[AddonModFeedbackSyncProvider.AUTO_SYNCED]: AddonModFeedbackAutoSyncData; [AddonModFeedbackSyncProvider.AUTO_SYNCED]: AddonModFeedbackAutoSyncData;
} }

View File

@ -19,7 +19,7 @@ import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom'; import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { AddonModFeedbackModuleHandlerService } from './module'; import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
/** /**
* Content links handler for a feedback analysis. * Content links handler for a feedback analysis.
@ -54,7 +54,7 @@ export class AddonModFeedbackAnalysisLinkHandlerService extends CoreContentLinks
); );
await CoreNavigator.navigateToSitePath( await CoreNavigator.navigateToSitePath(
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}`, ADDON_MOD_FEEDBACK_PAGE_NAME + `/${module.course}/${module.id}`,
{ {
params: { params: {
module, module,

View File

@ -20,7 +20,7 @@ import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom'; import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { AddonModFeedbackModuleHandlerService } from './module'; import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
/** /**
* Content links handler for feedback complete questions. * Content links handler for feedback complete questions.
@ -50,7 +50,7 @@ export class AddonModFeedbackCompleteLinkHandlerService extends CoreContentLinks
); );
await CoreNavigator.navigateToSitePath( await CoreNavigator.navigateToSitePath(
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/form`, ADDON_MOD_FEEDBACK_PAGE_NAME + `/${module.course}/${module.id}/form`,
{ {
params: { params: {
page: params.gopage !== undefined ? Number(params.gopage) : undefined, page: params.gopage !== undefined ? Number(params.gopage) : undefined,

View File

@ -17,6 +17,7 @@ import { Injectable, Type } from '@angular/core';
import { CoreCourseModuleHandler } from '@features/course/services/module-delegate'; import { CoreCourseModuleHandler } from '@features/course/services/module-delegate';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { CoreModuleHandlerBase } from '@features/course/classes/module-base-handler'; import { CoreModuleHandlerBase } from '@features/course/classes/module-base-handler';
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
/** /**
* Handler to support feedback modules. * Handler to support feedback modules.
@ -24,11 +25,9 @@ import { CoreModuleHandlerBase } from '@features/course/classes/module-base-hand
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class AddonModFeedbackModuleHandlerService extends CoreModuleHandlerBase implements CoreCourseModuleHandler { export class AddonModFeedbackModuleHandlerService extends CoreModuleHandlerBase implements CoreCourseModuleHandler {
static readonly PAGE_NAME = 'mod_feedback';
name = 'AddonModFeedback'; name = 'AddonModFeedback';
modName = 'feedback'; modName = 'feedback';
protected pageName = AddonModFeedbackModuleHandlerService.PAGE_NAME; protected pageName = ADDON_MOD_FEEDBACK_PAGE_NAME;
supportedFeatures = { supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true, [CoreConstants.FEATURE_GROUPS]: true,

View File

@ -25,10 +25,10 @@ import { makeSingleton } from '@singletons';
import { import {
AddonModFeedback, AddonModFeedback,
AddonModFeedbackGetFeedbackAccessInformationWSResponse, AddonModFeedbackGetFeedbackAccessInformationWSResponse,
AddonModFeedbackProvider,
AddonModFeedbackWSFeedback, AddonModFeedbackWSFeedback,
} from '../feedback'; } from '../feedback';
import { AddonModFeedbackSync, AddonModFeedbackSyncResult } from '../feedback-sync'; import { AddonModFeedbackSync, AddonModFeedbackSyncResult } from '../feedback-sync';
import { ADDON_MOD_FEEDBACK_COMPONENT } from '../../constants';
/** /**
* Handler to prefetch feedbacks. * Handler to prefetch feedbacks.
@ -38,7 +38,7 @@ export class AddonModFeedbackPrefetchHandlerService extends CoreCourseActivityPr
name = 'AddonModFeedback'; name = 'AddonModFeedback';
modName = 'feedback'; modName = 'feedback';
component = AddonModFeedbackProvider.COMPONENT; component = ADDON_MOD_FEEDBACK_COMPONENT;
updatesNames = /^configuration$|^.*files$|^attemptsfinished|^attemptsunfinished$/; updatesNames = /^configuration$|^.*files$|^attemptsfinished|^attemptsunfinished$/;
/** /**

View File

@ -20,7 +20,7 @@ import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom'; import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { AddonModFeedbackModuleHandlerService } from './module'; import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
/** /**
* Content links handler for feedback print questions. * Content links handler for feedback print questions.
@ -50,7 +50,7 @@ export class AddonModFeedbackPrintLinkHandlerService extends CoreContentLinksHan
); );
await CoreNavigator.navigateToSitePath( await CoreNavigator.navigateToSitePath(
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/form`, ADDON_MOD_FEEDBACK_PAGE_NAME + `/${module.course}/${module.id}/form`,
{ {
params: { params: {
preview: true, preview: true,

View File

@ -20,7 +20,7 @@ import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites'; import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom'; import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { AddonModFeedbackModuleHandlerService } from './module'; import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
/** /**
* Content links handler for feedback show non respondents. * Content links handler for feedback show non respondents.
* Match mod/feedback/show_nonrespondents.php with a valid feedback id. * Match mod/feedback/show_nonrespondents.php with a valid feedback id.
@ -49,7 +49,7 @@ export class AddonModFeedbackShowNonRespondentsLinkHandlerService extends CoreCo
); );
await CoreNavigator.navigateToSitePath( await CoreNavigator.navigateToSitePath(
AddonModFeedbackModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/nonrespondents`, ADDON_MOD_FEEDBACK_PAGE_NAME + `/${module.course}/${module.id}/nonrespondents`,
{ siteId }, { siteId },
); );
} catch (error) { } catch (error) {