MOBILE-3109 badges: Fix badge alignment renamed in WS
parent
b2497a1dd0
commit
5699c9b738
|
@ -172,14 +172,14 @@
|
|||
</ion-item-group>
|
||||
|
||||
<!-- Competencies alignment -->
|
||||
<ion-item-group *ngIf="badge && badge.competencies">
|
||||
<ion-item-group *ngIf="badge && badge.alignment">
|
||||
<ion-item-divider>
|
||||
<h2>{{ 'addon.badges.alignment' | translate}}</h2>
|
||||
</ion-item-divider>
|
||||
<a ion-item text-wrap *ngFor="let competency of badge.competencies" [href]="competency.targeturl" core-link auto-login="no">
|
||||
<h2><core-format-text [text]="competency.targetname"></core-format-text></h2>
|
||||
<a ion-item text-wrap *ngFor="let alignment of badge.alignment" [href]="alignment.targeturl" core-link auto-login="no">
|
||||
<h2><core-format-text [text]="alignment.targetname"></core-format-text></h2>
|
||||
</a>
|
||||
<ion-item text-wrap *ngIf="badge.competencies.length == 0">
|
||||
<ion-item text-wrap *ngIf="badge.alignment.length == 0">
|
||||
<h2>{{ 'addon.badges.noalignment' | translate}}</h2>
|
||||
</ion-item>
|
||||
</ion-item-group>
|
||||
|
|
|
@ -86,8 +86,13 @@ export class AddonBadgesProvider {
|
|||
updateFrequency: CoreSite.FREQUENCY_RARELY
|
||||
};
|
||||
|
||||
return site.read('core_badges_get_user_badges', data, preSets).then((response) => {
|
||||
return site.read('core_badges_get_user_badges', data, preSets).then((response: AddonBadgesGetUserBadgesResult) => {
|
||||
if (response && response.badges) {
|
||||
// In 3.7, competencies was renamed to alignment. Rename the property in 3.6 too.
|
||||
response.badges.forEach((badge) => {
|
||||
badge.alignment = badge.alignment || badge.competencies;
|
||||
});
|
||||
|
||||
return response.badges;
|
||||
} else {
|
||||
return Promise.reject(null);
|
||||
|
@ -167,7 +172,7 @@ export type AddonBadgesUserBadge = {
|
|||
claimcomment: string; // Claim comment.
|
||||
dateissued: number; // Date issued.
|
||||
};
|
||||
alignment: { // @since 3.6. Badge alignments.
|
||||
alignment?: { // @since 3.7. Calculated by the app for 3.6 sites. Badge alignments.
|
||||
id?: number; // Alignment id.
|
||||
badgeid?: number; // Badge id.
|
||||
targetName?: string; // Target name.
|
||||
|
@ -176,7 +181,16 @@ export type AddonBadgesUserBadge = {
|
|||
targetFramework?: string; // Target framework.
|
||||
targetCode?: string; // Target code.
|
||||
}[];
|
||||
relatedbadges: { // @since 3.6. Related badges.
|
||||
competencies?: { // @deprecated from 3.7. @since 3.6. In 3.7 it was renamed to alignment.
|
||||
id?: number; // Alignment id.
|
||||
badgeid?: number; // Badge id.
|
||||
targetName?: string; // Target name.
|
||||
targetUrl?: string; // Target URL.
|
||||
targetDescription?: string; // Target description.
|
||||
targetFramework?: string; // Target framework.
|
||||
targetCode?: string; // Target code.
|
||||
}[];
|
||||
relatedbadges?: { // @since 3.6. Related badges.
|
||||
id: number; // Badge id.
|
||||
name: string; // Badge name.
|
||||
version?: string; // Version.
|
||||
|
|
Loading…
Reference in New Issue