Skip to content

Commit

Permalink
Fixed choosing core subject and choosing practical combination being …
Browse files Browse the repository at this point in the history
…valid.
  • Loading branch information
RbkGh committed Feb 26, 2017
1 parent a7483ce commit 126d148
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app/components/main-content/subject/subject.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ export class SubjectComponent implements OnInit {

console.log(addSubjectForm);
let yearGroupsArray: Array<number> = new Array<number>();
let isSubjectAPracticalSubjectConvertedToBoolean:boolean = (addSubjectForm.value.isSubjectAPracticalSubject === "true"); //convert string to boolean in javascript
if (addSubjectForm.value.subjectYearGroupList1 === true) {
yearGroupsArray.push(1);
}
Expand All @@ -328,7 +329,7 @@ export class SubjectComponent implements OnInit {
addSubjectForm.value.subjectCode,
yearGroupsArray,
addSubjectForm.value.subjectType,
addSubjectForm.value.isSubjectAPracticalSubject,
isSubjectAPracticalSubjectConvertedToBoolean,
null);
}

Expand Down Expand Up @@ -383,8 +384,16 @@ export class SubjectComponent implements OnInit {

public addSubject(addSubjectForm: AbstractControl): void {

let isSubjectAPracticalSubjectConvertedToBoolean:boolean = (addSubjectForm.value.isSubjectAPracticalSubject === "true"); //convert string to boolean in javascript
console.log("addSubjectForm.value.isSubjectAPracticalSubject ="+addSubjectForm.value.isSubjectAPracticalSubject+"Expression (addSubjectForm.value.isSubjectAPracticalSubject===true) ="+(addSubjectForm.value.isSubjectAPracticalSubject===true));
if(isSubjectAPracticalSubjectConvertedToBoolean === true) {
if(addSubjectForm.value.subjectType === this.CORE_SUBJECT_NOTATION) {
swal("Error","If Subject is a practical subject,it cannot be a core subject at the same time","error");
return ;
}
}
let subjectJsonObject = this.prepareSubjectJson(addSubjectForm);

console.log("subjectJsonObject ==>",subjectJsonObject);
this.accessingService = true;
this.subjectService.createSubject(subjectJsonObject).subscribe(
(response: TutorResponsePayload) => {
Expand Down

0 comments on commit 126d148

Please sign in to comment.