Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Van Renterghem committed Nov 21, 2019
1 parent 39cf1cb commit addd954
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions src/models/Student.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export interface IStudentInternship {
}

export class Student extends ModelBase<IStudent> {

public get fullName(): string {
if (this.lastName === undefined) {
return this.firstName;
Expand All @@ -20,9 +19,7 @@ export class Student extends ModelBase<IStudent> {
}

public get internshipNumberOfDays(): number {
return this.internship !== undefined
? this.internship.endDate.diff(this.internship.startDate, "days") + 1
: 0;
return this.internship !== undefined ? this.internship.endDate.diff(this.internship.startDate, "days") + 1 : 0;
}

constructor(
Expand All @@ -32,7 +29,7 @@ export class Student extends ModelBase<IStudent> {
public schoolId: string | undefined,
public educationId: string | undefined,
public isPlanned: boolean,
public internship: IStudentInternship | undefined,
public internship: IStudentInternship | undefined
) {
super();
}
Expand All @@ -48,11 +45,11 @@ export class Student extends ModelBase<IStudent> {
entity.internship === undefined
? undefined
: {
startDate: moment(entity.internship.startDate.toDate()),
endDate: moment(entity.internship.endDate.toDate()),
hours: entity.internship.hours,
departmentId: entity.internship.departmentId,
},
startDate: moment(entity.internship.startDate.toDate()),
endDate: moment(entity.internship.endDate.toDate()),
hours: entity.internship.hours,
departmentId: entity.internship.departmentId,
}
);
student.fillBaseFields(entity);
return student;
Expand All @@ -75,7 +72,10 @@ export class Student extends ModelBase<IStudent> {
return days;
}

public getInternshipNumberOfHoursInRange(from: moment.Moment | undefined, until: moment.Moment | undefined): number {
public getInternshipNumberOfHoursInRange(
from: moment.Moment | undefined,
until: moment.Moment | undefined
): number {
const totalDays = this.internshipNumberOfDays;
if (totalDays === 0 || this.internship === undefined) {
return 0;
Expand All @@ -94,18 +94,19 @@ export class Student extends ModelBase<IStudent> {
schoolId: this.schoolId,
educationId: this.educationId,
isPlanned: this.isPlanned,
internship: this.internship === undefined
? undefined
: {
startDate: Firebase.firestore.Timestamp.fromDate(
this.internship.startDate.startOf("day").toDate(),
),
endDate: Firebase.firestore.Timestamp.fromDate(
this.internship.endDate.startOf("day").toDate(),
),
hours: this.internship.hours,
departmentId: this.internship.departmentId,
},
internship:
this.internship === undefined
? undefined
: {
startDate: Firebase.firestore.Timestamp.fromDate(
this.internship.startDate.startOf("day").toDate()
),
endDate: Firebase.firestore.Timestamp.fromDate(
this.internship.endDate.startOf("day").toDate()
),
hours: this.internship.hours,
departmentId: this.internship.departmentId,
},
};
}
}

0 comments on commit addd954

Please sign in to comment.