Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #SB-27808 fix : Extra Q1 removed from submission preview #235

Open
wants to merge 4 commits into
base: release-4.6.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/manage-learn/core/guards/ml.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export class MlGuard implements CanActivate {
if (data.role) {
resolve(true)
} else {
this.toast.showMessage("You do not have access. Please update you profile", 'danger');
this.toast.showMessage("You do not have access. Please update your profile", 'danger');
resolve(false);
}
}).catch(error => {
this.toast.showMessage("You do not have access.Please update you profile", 'danger');
this.toast.showMessage("You do not have access.Please update your profile", 'danger');
resolve(false)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ export class ProjectTemplatePage {
} catch (error) {
console.log(error);
}

if (resp && resp.result) {
if (resp && resp.result && resp.result._id) {
this.router
.navigate([`/${RouterLinks.PROJECT}`], {
queryParams: {
Expand All @@ -205,6 +204,8 @@ export class ProjectTemplatePage {
},
});
});
}else{
this.toast.showMessage(resp?.message,'danger');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h3>Q{{ i + 1 }}. {{ question?.question[0] }}</h3>
question?.responseType === 'matrix' && question?.responseType !== 'pageQuestions' && question?.value
"
>
<h3>Q{{ i + 1 }}. {{ question?.question[0] }}</h3>
<!-- <h3>Q{{ i + 1 }}. {{ question?.question[0] }}</h3> -->
<div *ngFor="let instance of question.value; let j = index" class="instanceQuest">
<h5 class="instacnce">{{ question?.instanceIdentifier }} {{ j + 1 }}</h5>
<div *ngFor="let answer of instance; let k = index" class="matrixQuestion">
Expand All @@ -52,8 +52,7 @@ <h3>Q{{ k + 1 }}. {{ answer?.question[0] }}</h3>
</div>
</div>
<div *ngIf="question?.responseType === 'pageQuestions'">
<h3>Q{{ i + 1 }}. {{ question?.question[0] }}</h3>

<!-- <h3>Q{{ i + 1 }}. {{ question?.question[0] }}</h3> -->
<div *ngFor="let answer of question.pageQuestions; let k = index" class="matrixQuestion">
<div *ngIf="answer?.responseType === 'matrix'; else notMatrix">
<div *ngIf="answer.value">
Expand Down
4 changes: 3 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1507,5 +1507,7 @@
"FRMELEMNTS_LBL_EARNMCERT" : "Certificate will be issued if you score above {{percent}}% in your assessments",
"FRMELEMNTS_LBL_EARNYOURCERT" : "Completion certificate will be issued upon 100% completion",
"FRMELEMNTS_MSG_INVALID_LINK":"Invalid Link, please try with other link",
"FRMELEMNTS_MSG_TEMPLATE_DETAILS_NOTFOUND":"Template details not found"
"FRMELEMNTS_MSG_TEMPLATE_DETAILS_NOTFOUND":"Template details not found",
"FRMELEMNTS_MSG_CONTENT_NOT_AVAILABLE_FOR_ROLE":"This content is not available for your Role",
"FRMELEMNTS_MSG_PLEASE_LOGIN_HT_OTHER":"Please login as HT & Other Officials to access this content"
}
65 changes: 60 additions & 5 deletions src/services/qrscanresulthandler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import {
CorrelationData,
TelemetryObject,
TelemetryService,
SharedPreferences,
} from 'sunbird-sdk';
import { EventTopics, RouterLinks } from '../app/app.constant';
import { EventTopics, RouterLinks,MimeType,PreferenceKey } from '../app/app.constant';

import { CommonUtilService } from './common-util.service';
import {
Expand All @@ -32,6 +33,8 @@ import { FormAndFrameworkUtilService } from './formandframeworkutil.service';
import { ContentUtil } from '@app/util/content-util';
import * as qs from 'qs';
import { NavigationService } from './navigation-handler.service';
import { FormConstants } from '@app/app/form.constants';
import { SbProgressLoader } from './sb-progress-loader.service';

declare var cordova;

Expand All @@ -41,20 +44,25 @@ export class QRScannerResultHandler {
source: string;
inAppBrowserRef: any;
scannedUrlMap: object;

private progressLoaderId: string;
private enableRootNavigation = false;
selectedUserType?: any;
guestUser: boolean = false;
constructor(
@Inject('CONTENT_SERVICE') private contentService: ContentService,
@Inject('TELEMETRY_SERVICE') private telemetryService: TelemetryService,
@Inject('PAGE_ASSEMBLE_SERVICE') private pageAssembleService: PageAssembleService,
@Inject('FRAMEWORK_SERVICE') private frameworkService: FrameworkService,
@Inject('SHARED_PREFERENCES') private preferences: SharedPreferences,
private commonUtilService: CommonUtilService,
private telemetryGeneratorService: TelemetryGeneratorService,
private router: Router,
private navCtrl: NavController,
private events: Events,
private appGlobalService: AppGlobalService,
private formFrameWorkUtilService: FormAndFrameworkUtilService,
private navService: NavigationService
private navService: NavigationService,
private sbProgressLoader: SbProgressLoader
) {
}

Expand Down Expand Up @@ -280,7 +288,6 @@ export class QRScannerResultHandler {
generateEndEvent(pageId: string, qrData: string) {
if (pageId) {
const telemetryObject = new TelemetryObject(qrData, QRScannerResultHandler.CORRELATION_TYPE, undefined);

this.telemetryGeneratorService.generateEndTelemetry(
QRScannerResultHandler.CORRELATION_TYPE,
Mode.PLAY,
Expand All @@ -301,4 +308,52 @@ export class QRScannerResultHandler {
undefined,
corRelationList);
}
}

async manageLearScan(scannedData) {
this.selectedUserType = await this.preferences.getString(PreferenceKey.SELECTED_USER_TYPE).toPromise();
if (!this.appGlobalService.isUserLoggedIn()) {
this.commonUtilService.showToast("FRMELEMNTS_MSG_PLEASE_LOGIN_HT_OTHER");
return;
}
if (scannedData.includes('/create-project/') && this.selectedUserType == "administrator") {
this.navigateHandler(scannedData);
return;
} else if ((scannedData.includes('/create-observation/')) && (this.selectedUserType == "administrator" || this.selectedUserType == "teacher")) {
this.navigateHandler(scannedData);
return;
} else {
this.commonUtilService.showToast('FRMELEMNTS_MSG_CONTENT_NOT_AVAILABLE_FOR_ROLE');
}
}
async navigateHandler(scannedData) {
const deepLinkUrlConfig: { name: string, code: string, pattern: string, route: string, priority?: number, params?: {} }[] =
await this.formFrameWorkUtilService.getFormFields(FormConstants.DEEPLINK_CONFIG);
let matchedDeeplinkConfig: { name: string, code: string, pattern: string, route: string, priority?: number } = null;
let urlMatch;
deepLinkUrlConfig.forEach(config => {
const urlRegexMatch = scannedData.match(new RegExp(config.pattern));
if (!!urlRegexMatch && (!matchedDeeplinkConfig)) {
if (config.code === 'profile' && !this.appGlobalService.isUserLoggedIn()) {
config.route = 'tabs/guest-profile';
}
matchedDeeplinkConfig = config;
urlMatch = urlRegexMatch;
}
});
if (!matchedDeeplinkConfig) {
return;
}
let identifier;
if (urlMatch && urlMatch.groups && Object.keys(urlMatch.groups).length) {
identifier = urlMatch.groups.quizId || urlMatch.groups.content_id || urlMatch.groups.course_id;
}
let extras = {};
const route = matchedDeeplinkConfig.route;
extras = {
state: {
data: urlMatch.groups
}
};
this.navCtrl.navigateForward([route], extras);
}
}
4 changes: 1 addition & 3 deletions src/services/sunbirdqrscanner.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ private getProfileSettingConfig() {
return new Promise<string | undefined>((resolve, reject) => {
(window as any).qrScanner.startScanner(screenTitle, displayText,
displayTextColor, buttonText, showButton, this.platform.isRTL, async (scannedData) => {
alert("scanned")
alert(JSON.stringify(scannedData))
if (scannedData === 'skip') {
if (this.appGlobalService.DISPLAY_ONBOARDING_CATEGORY_PAGE) {
this.stopScanner();
Expand Down Expand Up @@ -265,7 +263,7 @@ private getProfileSettingConfig() {
} else if (scannedData.includes('/certs/')) {
this.qrScannerResultHandler.handleCertsQR(source, scannedData);
} else if(scannedData.includes('/manage-learn/')) {
alert("in manage learn")
this.qrScannerResultHandler.manageLearScan(scannedData);
}else {
this.qrScannerResultHandler.handleInvalidQRCode(source, scannedData);
this.showInvalidCodeAlert(scannedData);
Expand Down