Skip to content

Commit

Permalink
Merge pull request #461 from shikshalokam/ED-4470
Browse files Browse the repository at this point in the history
ISSUE ED-4470 : fix : Download issue for observation which are mapped…
  • Loading branch information
vishwanath1004 authored Aug 16, 2024
2 parents 972c1b2 + 8abffee commit 55fb842
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/app/manage-learn/core/services/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class ProjectService {
private share: SharingFeatureService,
private syncService: SyncService,
private popupService: GenericPopUpService,

) {
this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable;
this._networkSubscription = this.commonUtilService.networkAvailability$.subscribe(async (available: boolean) => {
Expand Down Expand Up @@ -201,7 +202,7 @@ export class ProjectService {
return payload;
}

async startAssessment(projectId, id) {
async startAssessment(projectId, id, programName?) {
this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable;
if (!this.networkFlag) {
this.toast.showMessage('FRMELEMNTS_MSG_YOU_ARE_WORKING_OFFLINE_TRY_AGAIN', 'danger');
Expand Down Expand Up @@ -246,15 +247,17 @@ export class ProjectService {
observationId: data.observationId,
entityId: data.entityId,
entityName: data.entityName,
programJoined: true
programJoined: true,
name:data.solutionDetails.name,
programName:programName
},
});
}, (error) => {
this.toast.showMessage('FRMELEMNTS_MSG_CANNOT_GET_PROJECT_DETAILS', "danger");
})
}

async checkReport(projectId, taskId) {
async checkReport(projectId, taskId, programName?) {
this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable;
if (!this.networkFlag) {
this.toast.showMessage('FRMELEMNTS_MSG_YOU_ARE_WORKING_OFFLINE_TRY_AGAIN', 'danger');
Expand All @@ -272,15 +275,16 @@ export class ProjectService {
this.toast.showMessage('FRMELEMNTS_MSG_CANNOT_GET_PROJECT_DETAILS', "danger");
return;
}
let data = success.result;

let data = success.result;
this.router.navigate([`/${RouterLinks.OBSERVATION}/${RouterLinks.OBSERVATION_SUBMISSION}`], {
queryParams: {
programId: data.programId,
solutionId: data.solutionId,
observationId: data.observationId,
entityId: data.entityId,
entityName: data.entityName,
name:data.solutionDetails.name,
programName:programName
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,17 @@ export class ObservationSubmissionComponent implements OnInit {
this.entityName = params.entityName;
this.disableObserveAgain = params.disableObserveAgain == "true";
this.programJoined = params.programJoined == 'true'

let data = {
observationId: this.observationId,
entityId: this.entityId
};
this.generatedKey = this.utils.getUniqueKey(data,storageKeys.submissionsList);
params?.name ? this.observationService.obsTraceObj.name = params?.name :''
params.observationId ? this.observationService.obsTraceObj.observationId = params.observationId: ''
params.programId ? this.observationService.obsTraceObj.programId = params.programId :'';
params.programName ? this.observationService.obsTraceObj.programName = params.programName :'';
params.solutionId ? this.observationService.obsTraceObj.solutionId = params.solutionId : '';
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { menuConstants } from '../../../../../app/manage-learn/core/constants/me
import { PopoverController, AlertController } from '@ionic/angular';
import { TranslateService } from '@ngx-translate/core';
import { PopoverComponent } from '../popover/popover.component';
import { ObservationService } from '../../../observation/observation.service';
// import * as _ from 'underscore';

@Component({
Expand All @@ -30,7 +31,9 @@ export class TaskCardComponent implements OnInit {
private translate: TranslateService,
private alert: AlertController,
private db: DbService,
private util: UtilsService
private util: UtilsService,
public obsService: ObservationService

) { }

ngOnInit() {
Expand Down Expand Up @@ -59,7 +62,7 @@ export class TaskCardComponent implements OnInit {
return;
}
const submissionDetails = this.data?.tasks[index]?.submissionDetails;
if(submissionDetails?.observationId) {
if(!submissionDetails?.observationId) {
this.router.navigate([`/${RouterLinks.OBSERVATION}/${RouterLinks.OBSERVATION_SUBMISSION}`], {
queryParams: {
programId: submissionDetails.programId,
Expand All @@ -70,14 +73,20 @@ export class TaskCardComponent implements OnInit {
disableObserveAgain: this.data?.tasks[index].status === statusType.completed,
programJoined:true
},
})
.then(() => {
this.obsService.obsTraceObj.programId = submissionDetails.programId;
this.obsService.obsTraceObj.solutionId = submissionDetails.solutionId;
this.obsService.obsTraceObj.name = this.data?.tasks[index].solutionDetails?.name;
this.obsService.obsTraceObj.programName = this.data.programName;
});
} else {
this.projectService.startAssessment(this.data._id, task._id);
this.projectService.startAssessment(this.data._id, task._id,this.data.programName);
}
}

checkReport(task) {
this.projectService.checkReport(this.data._id, task._id);
this.projectService.checkReport(this.data._id, task._id,this.data.programName);
}
openResources(task) {
this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.LEARNING_RESOURCES}`, this.data._id, task._id]);
Expand Down

0 comments on commit 55fb842

Please sign in to comment.