MOBILE-4284 quiz: Replace number w/ questionnumber

main
Noel De Martin 2023-04-17 14:55:03 +02:00
parent 391dfbdfcc
commit e77b834ff2
5 changed files with 23 additions and 16 deletions

View File

@ -18,11 +18,11 @@
(click)="loadPage(question.page, question.slot)" detail="false">
<ion-label>
<span *ngIf="question.number">{{ 'core.question.questionno' | translate:{$a: question.number} }}</span>
<span *ngIf="!question.number">{{ 'core.question.information' | translate }}</span>
<span *ngIf="question.questionnumber">{{ 'core.question.questionno' | translate:{$a: question.questionnumber} }}</span>
<span *ngIf="!question.questionnumber">{{ 'core.question.information' | translate }}</span>
</ion-label>
<ion-icon *ngIf="!question.number" name="fas-circle-info" slot="end" aria-hidden="true"></ion-icon>
<ion-icon *ngIf="!question.questionnumber" name="fas-circle-info" slot="end" aria-hidden="true"></ion-icon>
<ion-icon *ngIf="question.stateClass == 'core-question-requiresgrading'" name="fas-circle-question"
[attr.aria-label]="question.status" slot="end">
</ion-icon>

View File

@ -44,10 +44,10 @@
<!-- "Header" of the question. -->
<ion-item-divider>
<ion-label>
<h2 *ngIf="question.number" class="inline">
{{ 'core.question.questionno' | translate:{$a: question.number} }}
<h2 *ngIf="question.questionnumber" class="inline">
{{ 'core.question.questionno' | translate:{$a: question.questionnumber} }}
</h2>
<h2 *ngIf="!question.number" class="inline">{{ 'core.question.information' | translate }}</h2>
<h2 *ngIf="!question.questionnumber" class="inline">{{ 'core.question.information' | translate }}</h2>
</ion-label>
<div *ngIf="question.status || question.readableMark" slot="end"
class="ion-text-wrap ion-margin-horizontal addon-mod_quiz-question-note">
@ -108,12 +108,12 @@
<!-- List of questions of the summary table. -->
<ng-container *ngFor="let question of summaryQuestions">
<ion-item *ngIf="question.number" (click)="changePage(question.page, false, question.slot)"
[attr.aria-label]="'core.question.questionno' | translate:{$a: question.number}" [detail]="!isSequential && canReturn"
[button]="!isSequential && canReturn">
<ion-item *ngIf="question.questionnumber" (click)="changePage(question.page, false, question.slot)"
[attr.aria-label]="'core.question.questionno' | translate:{$a: question.questionnumber}"
[detail]="!isSequential && canReturn" [button]="!isSequential && canReturn">
<ion-label>
<ion-row class="ion-align-items-center">
<ion-col size="3" class="ion-text-center">{{ question.number }}</ion-col>
<ion-col size="3" class="ion-text-center">{{ question.questionnumber }}</ion-col>
<ion-col size="9" class="ion-text-center ion-text-wrap">{{ question.status }}</ion-col>
</ion-row>
</ion-label>

View File

@ -86,8 +86,9 @@
<!-- "Header" of the question. -->
<ion-item-divider>
<ion-label>
<h2 *ngIf="question.number">{{ 'core.question.questionno' | translate:{$a: question.number} }}</h2>
<h2 *ngIf="!question.number">{{ 'core.question.information' | translate }}</h2>
<h2 *ngIf="question.questionnumber">{{ 'core.question.questionno' | translate:{$a: question.questionnumber} }}
</h2>
<h2 *ngIf="!question.questionnumber">{{ 'core.question.information' | translate }}</h2>
</ion-label>
<div class="ion-text-wrap ion-margin-horizontal addon-mod_quiz-question-note" slot="end"
*ngIf="question.status || question.readableMark">

View File

@ -637,7 +637,7 @@ export class CoreQuestionHelperProvider {
): Promise<void> {
if (!component) {
component = CoreQuestionProvider.COMPONENT;
componentId = question.number;
componentId = question.questionnumber;
}
const files = CoreQuestionDelegate.getAdditionalDownloadableFiles(question, usageId) || [];

View File

@ -314,7 +314,7 @@ export class CoreQuestionProvider {
* @returns Question component ID.
*/
getQuestionComponentId(question: CoreQuestionQuestionParsed, componentId: string | number): string {
return componentId + '_' + question.number;
return componentId + '_' + question.questionnumber;
}
/**
@ -385,6 +385,10 @@ export class CoreQuestionProvider {
const parsedQuestions: CoreQuestionQuestionParsed[] = questions;
parsedQuestions.forEach((question) => {
if (typeof question.questionnumber === 'undefined' && typeof question.number === 'number') {
question.questionnumber = String(question.number);
}
if (!question.settings) {
return;
}
@ -591,14 +595,16 @@ export type CoreQuestionQuestionWSData = {
lastactiontime?: number; // The timestamp of the most recent step in this question attempt.
hasautosavedstep?: boolean; // Whether this question attempt has autosaved data.
flagged: boolean; // Whether the question is flagged or not.
// eslint-disable-next-line id-blacklist
number?: number; // Question ordering number in the quiz.
questionnumber?: string; // @since 4.2. Question ordering number in the quiz.
state?: string; // The state where the question is in. It won't be returned if the user cannot see it.
status?: string; // Current formatted state of the question.
blockedbyprevious?: boolean; // Whether the question is blocked by the previous question.
mark?: string; // The mark awarded. It will be returned only if the user is allowed to see it.
maxmark?: number; // The maximum mark possible for this question attempt.
settings?: string; // Question settings (JSON encoded).
/** @deprecated Since 4.2. Use questionnumber instead. */
number?: number; // eslint-disable-line id-blacklist
};
/**
* Question data with parsed data.