commit
38f4dcd38b
|
@ -291,16 +291,16 @@ export class AddonModGlossaryProvider {
|
||||||
glossaryId: number,
|
glossaryId: number,
|
||||||
options: AddonModGlossaryGetEntriesOptions = {},
|
options: AddonModGlossaryGetEntriesOptions = {},
|
||||||
): Promise<AddonModGlossaryGetEntriesWSResponse> {
|
): Promise<AddonModGlossaryGetEntriesWSResponse> {
|
||||||
options.from = options.from || 0;
|
const from = options.from || 0;
|
||||||
options.limit = options.limit || AddonModGlossaryProvider.LIMIT_ENTRIES;
|
const limit = options.limit || AddonModGlossaryProvider.LIMIT_ENTRIES;
|
||||||
|
|
||||||
const site = await CoreSites.getSite(options.siteId);
|
const site = await CoreSites.getSite(options.siteId);
|
||||||
|
|
||||||
const params: AddonModGlossaryGetEntriesByLetterWSParams = {
|
const params: AddonModGlossaryGetEntriesByLetterWSParams = {
|
||||||
id: glossaryId,
|
id: glossaryId,
|
||||||
letter: 'ALL',
|
letter: 'ALL',
|
||||||
from: options.from,
|
from,
|
||||||
limit: options.limit,
|
limit,
|
||||||
};
|
};
|
||||||
const preSets: CoreSiteWSPreSets = {
|
const preSets: CoreSiteWSPreSets = {
|
||||||
cacheKey: this.getEntriesByLetterCacheKey(glossaryId),
|
cacheKey: this.getEntriesByLetterCacheKey(glossaryId),
|
||||||
|
@ -316,9 +316,9 @@ export class AddonModGlossaryProvider {
|
||||||
preSets,
|
preSets,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (options.limit == AddonModGlossaryProvider.LIMIT_ENTRIES) {
|
if (limit === AddonModGlossaryProvider.LIMIT_ENTRIES) {
|
||||||
// Store entries in background, don't block the user for this.
|
// Store entries in background, don't block the user for this.
|
||||||
CoreUtils.ignoreErrors(this.storeEntries(glossaryId, result.entries, options.from, site.getId()));
|
CoreUtils.ignoreErrors(this.storeEntries(glossaryId, result.entries, from, site.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -446,13 +446,13 @@ export class AddonModGlossaryProvider {
|
||||||
site: CoreSite,
|
site: CoreSite,
|
||||||
options: AddonModGlossaryGetCategoriesOptions = {},
|
options: AddonModGlossaryGetCategoriesOptions = {},
|
||||||
): Promise<AddonModGlossaryCategory[]> {
|
): Promise<AddonModGlossaryCategory[]> {
|
||||||
options.from = options.from || 0;
|
const from = options.from || 0;
|
||||||
options.limit = options.limit || AddonModGlossaryProvider.LIMIT_CATEGORIES;
|
const limit = options.limit || AddonModGlossaryProvider.LIMIT_CATEGORIES;
|
||||||
|
|
||||||
const params: AddonModGlossaryGetCategoriesWSParams = {
|
const params: AddonModGlossaryGetCategoriesWSParams = {
|
||||||
id: glossaryId,
|
id: glossaryId,
|
||||||
from: options.from,
|
from,
|
||||||
limit: options.limit,
|
limit,
|
||||||
};
|
};
|
||||||
const preSets: CoreSiteWSPreSets = {
|
const preSets: CoreSiteWSPreSets = {
|
||||||
cacheKey: this.getCategoriesCacheKey(glossaryId),
|
cacheKey: this.getCategoriesCacheKey(glossaryId),
|
||||||
|
@ -465,11 +465,12 @@ export class AddonModGlossaryProvider {
|
||||||
const response = await site.read<AddonModGlossaryGetCategoriesWSResponse>('mod_glossary_get_categories', params, preSets);
|
const response = await site.read<AddonModGlossaryGetCategoriesWSResponse>('mod_glossary_get_categories', params, preSets);
|
||||||
|
|
||||||
categories = categories.concat(response.categories);
|
categories = categories.concat(response.categories);
|
||||||
const canLoadMore = (options.from + options.limit) < response.count;
|
const canLoadMore = (from + limit) < response.count;
|
||||||
if (canLoadMore) {
|
if (canLoadMore) {
|
||||||
options.from += options.limit;
|
return this.getCategories(glossaryId, categories, site, {
|
||||||
|
...options,
|
||||||
return this.getCategories(glossaryId, categories, site, options);
|
from: from + limit,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return categories;
|
return categories;
|
||||||
|
|
|
@ -1100,23 +1100,25 @@ export class AddonModWorkshopProvider {
|
||||||
const args: string[] = field.name.split('_');
|
const args: string[] = field.name.split('_');
|
||||||
const name = args[0];
|
const name = args[0];
|
||||||
const idx = args[3];
|
const idx = args[3];
|
||||||
const idy = args[6] || false;
|
const idy = args[6];
|
||||||
|
const idxNumber = parseInt(args[3], 10);
|
||||||
|
const idyNumber = parseInt(args[6], 10);
|
||||||
|
|
||||||
if (parseInt(idx, 10) + '' == idx) {
|
if (!isNaN(idxNumber)) {
|
||||||
if (!parsedFields[idx]) {
|
if (!parsedFields[idx]) {
|
||||||
parsedFields[idx] = {
|
parsedFields[idx] = {
|
||||||
number: idx + 1, // eslint-disable-line id-blacklist
|
number: idxNumber + 1, // eslint-disable-line id-blacklist
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idy && parseInt(idy, 10) + '' == idy) {
|
if (!isNaN(idyNumber)) {
|
||||||
if (!parsedFields[idx].fields) {
|
if (!parsedFields[idx].fields) {
|
||||||
parsedFields[idx].fields = [];
|
parsedFields[idx].fields = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parsedFields[idx].fields[idy]) {
|
if (!parsedFields[idx].fields[idy]) {
|
||||||
parsedFields[idx].fields[idy] = {
|
parsedFields[idx].fields[idy] = {
|
||||||
number: idy + 1, // eslint-disable-line id-blacklist
|
number: idyNumber + 1, // eslint-disable-line id-blacklist
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
parsedFields[idx].fields[idy][name] = field.value;
|
parsedFields[idx].fields[idy][name] = field.value;
|
||||||
|
|
|
@ -83,7 +83,7 @@ Feature: Test basic usage of workshop activity in app
|
||||||
Then I should find "Task to do" within "Assess peers" "ion-item" in the app
|
Then I should find "Task to do" within "Assess peers" "ion-item" in the app
|
||||||
|
|
||||||
When I press "The Answer" in the app
|
When I press "The Answer" in the app
|
||||||
And I press "Grade for Aspect 01" in the app
|
And I press "Grade for Aspect 1" in the app
|
||||||
And I press "10 / 10" in the app
|
And I press "10 / 10" in the app
|
||||||
And I press "Save" in the app
|
And I press "Save" in the app
|
||||||
Then I should find "Assessed submission" in the app
|
Then I should find "Assessed submission" in the app
|
||||||
|
|
Loading…
Reference in New Issue