Skip to content

Commit

Permalink
Bugfix: internships summary for school included internships completel…
Browse files Browse the repository at this point in the history
…y outside the selected range
  • Loading branch information
BenjaVR committed Feb 24, 2019
1 parent fe1f1b3 commit 0009c4e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/schools/SchoolInternshipSummaryModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ class SchoolInternshipSummaryModal extends React.Component<SchoolInternshipSumma

public render(): React.ReactNode {
const studentsFullyInPeriod = this.state.studentsWithInternship.filter((student) => {
return this.state.selectedStartDate !== undefined && this.state.selectedEndDate && student.internship !== undefined
return this.state.selectedStartDate !== undefined && this.state.selectedEndDate !== undefined && student.internship !== undefined
&& student.internship.startDate.isSameOrAfter(this.state.selectedStartDate)
&& student.internship.endDate.isSameOrBefore(this.state.selectedEndDate);
});
const studentsNotFullyInPeriod = this.state.studentsWithInternship.filter((student) => {
return this.state.selectedStartDate !== undefined && this.state.selectedEndDate && student.internship !== undefined
&& (student.internship.startDate.isBefore(this.state.selectedStartDate)
|| student.internship.endDate.isAfter(this.state.selectedEndDate));
return this.state.selectedStartDate !== undefined && this.state.selectedEndDate !== undefined && student.internship !== undefined
&& ((student.internship.startDate.isBefore(this.state.selectedStartDate) && student.internship.endDate.isSameOrAfter(this.state.selectedStartDate))
|| (student.internship.endDate.isAfter(this.state.selectedEndDate) && student.internship.startDate.isSameOrBefore(this.state.selectedEndDate)));
});

const totalStudentsCount = studentsFullyInPeriod.length + studentsNotFullyInPeriod.length;
Expand Down

1 comment on commit 0009c4e

@BenjaVR
Copy link
Owner

@BenjaVR BenjaVR commented on 0009c4e Feb 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#59

Please sign in to comment.