Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(participant): check if file found
Browse files Browse the repository at this point in the history
Closes #551
  • Loading branch information
Christine Yu committed Mar 13, 2015
1 parent faf48e4 commit a02f693
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions app/scripts/components/ui/biospecimen/biospecimen.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@ module ngApp.components.ui.biospecimen.controllers {
activeBioSpecimenDocumentType: string;
displayBioSpecimenDocument(event: any, doc: any, type: string): void;
downloadBiospecimenXML(participant_id: string): void;
bioSpecimenFileId: string;
}

class BiospecimenController implements IBiospecimenController {
activeBioSpecimenDocument: any;
activeBioSpecimenDocumentType: string;
bioSpecimenFileId: string;

/* @ngInject */
constructor(private LocationService: ILocationService,
private config: IGDCConfig, $scope) {
$scope.participant.samples[0].expanded = true;
this.activeBioSpecimenDocument = $scope.participant.samples[0];

this.bioSpecimenFileId = _.find($scope.participant.files, (file) => {
var biospecimenFile = _.find($scope.participant.files, (file) => {
return file.data_subtype.toLowerCase() === "biospecimen data";
}).file_id;
});

if(biospecimenFile) {
this.bioSpecimenFileId = biospecimenFile.file_id;
}

}

displayBioSpecimenDocument(event: any, doc: any): void {
Expand Down
11 changes: 9 additions & 2 deletions app/scripts/participant/participants.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ module ngApp.participants.controllers {
export interface IParticipantController {
participant: IParticipant;
annotationIds: string[];
clinicalFileId: string;
DownloadClinicalXML(): void;
}

class ParticipantController implements IParticipantController {
annotationIds: string[];
clinicalFileId: string;
/* @ngInject */
constructor(public participant: IParticipant,
private CoreService: ICoreService,
Expand All @@ -24,9 +26,14 @@ module ngApp.participants.controllers {
return annotation.annotation_id;
});

this.clinicalFileId = _.find(this.participant.files, (file) => {
var clinicalFile = _.find(this.participant.files, (file) => {
return file.data_subtype.toLowerCase() === "clinical data";
}).file_id;
});

if(clinicalFile) {
this.clinicalFileId = clinicalFile.file_id;
}

}

}
Expand Down

0 comments on commit a02f693

Please sign in to comment.