fix condition

This commit is contained in:
Bright 2025-03-10 13:38:41 +07:00
parent efee15eb97
commit a35e5fca50

View file

@ -310,13 +310,13 @@ export class ReportController extends Controller {
if(!education && !educationLevel && !field) { if(!education && !educationLevel && !field) {
_educations = Array.isArray(x.Educations) && x.Educations != null _educations = Array.isArray(x.Educations) && x.Educations != null
? (x.Educations as any[]).filter( ? (x.Educations as any[]).filter(
(i: any) => i.isEducation === true (i: any) => i.isEducation == true
) )
: [] : []
if(_educations.length == 0) { if(_educations.length == 0) {
_educations = Array.isArray(x.Educations) && x.Educations != null _educations = Array.isArray(x.Educations) && x.Educations != null
? (x.Educations as any[]).filter( ? (x.Educations as any[]).filter(
(i: any) => i.isHigh === true (i: any) => i.isHigh == true
) )
: [] : []
// if(_educations.length == 0) { // if(_educations.length == 0) {
@ -330,9 +330,12 @@ export class ReportController extends Controller {
_educations = Array.isArray(x.Educations) && x.Educations != null _educations = Array.isArray(x.Educations) && x.Educations != null
? (x.Educations as any[]).filter( ? (x.Educations as any[]).filter(
(i: any) => (i: any) =>
i.degree === education || // i.degree === education ||
i.educationLevel === educationLevel || // i.educationLevel === educationLevel ||
i.field === field // i.field === field
(education ? i.degree?.toString().includes(education) : false) ||
(educationLevel ? i.educationLevel?.toString().includes(educationLevel) : false) ||
(field ? i.field?.toString().includes(field) : false)
) )
: [] : []
} }
@ -593,30 +596,25 @@ export class ReportController extends Controller {
if(!education && !educationLevel && !field) { if(!education && !educationLevel && !field) {
_educations = Array.isArray(x.Educations) && x.Educations != null _educations = Array.isArray(x.Educations) && x.Educations != null
? (x.Educations as any[]).filter( ? (x.Educations as any[]).filter(
(i: any) => i.isEducation === true (i: any) => i.isEducation == true
) )
: [] : []
if(_educations.length == 0) { if(_educations.length == 0) {
_educations = Array.isArray(x.Educations) && x.Educations != null _educations = Array.isArray(x.Educations) && x.Educations != null
? (x.Educations as any[]).filter( ? (x.Educations as any[]).filter(
(i: any) => i.isHigh === true (i: any) => i.isHigh == true
) )
: [] : []
// if(_educations.length == 0) {
// _educations = Array.isArray(x.Educations) && x.Educations != null
// ? (x.Educations as any[])[0]
// : []
// }
} }
} }
else { else {
_educations = Array.isArray(x.Educations) && x.Educations != null _educations = Array.isArray(x.Educations) && x.Educations != null
? (x.Educations as any[]).filter( ? (x.Educations as any[]).filter(
(i: any) => (i: any) =>
i.degree === education || (education ? i.degree?.toString().includes(education) : false) ||
i.educationLevel === educationLevel || (educationLevel ? i.educationLevel?.toString().includes(educationLevel) : false) ||
i.field === field (field ? i.field?.toString().includes(field) : false)
) )
: [] : []
} }
mapData.push({ mapData.push({