main-project/app/client/src/Components/Util/ViewHours.js
/*
        Complex filter function constructor.
        The constructed function is used as a filter by generateHoursRows().
        Called everytime "Apply Filter" is clicked.
       */
Complex filter function constructor.
The constructed function is used as a filter by generateHoursRows().
Called everytime "Apply Filter" is clicked.
Complex filter function constructor . The constructed function is used as a filter by generateHoursRows () . Called everytime " Apply Filter " is clicked .
constructFilterFunction() {
    const payCheck =
      this.state.isPaid === null
        ? _ => true
        : paid => paid === this.state.isPaid;
    const queryCheck = evnt => evnt.includes(this.state.purposeQuery);
    const fromCheck =
      this.state.fromDate === ""
        ? _ => true
        : date => new Date(date) >= new Date(this.state.fromDate + " 0:00:00");
    const toCheck =
      this.state.toDate === ""
        ? _ => true
        : date => new Date(date) <= new Date(this.state.toDate + " 23:59:59");
    const compiledFunc = hours_record => {
      return (
        hours_record &&
        payCheck(hours_record.paid) &&
        queryCheck(hours_record.purpose) &&
        fromCheck(hours_record.dateTime) &&
        toCheck(hours_record.dateTime)
      );
    };
    return compiledFunc;
  }
constructFilterFunction ( ) { const payCheck = this . state . isPaid === null ? _ => true : paid => paid === this . state . isPaid ; const queryCheck = evnt => evnt . includes ( this . state . purposeQuery ) ; const fromCheck = this . state . fromDate === "" ? _ => true : date => new Date ( date ) >= new Date ( this . state . fromDate + " 0:00:00" ) ; const toCheck = this . state . toDate === "" ? _ => true : date => new Date ( date ) <= new Date ( this . state . toDate + " 23:59:59" ) ; const compiledFunc = hours_record => { return ( hours_record && payCheck ( hours_record . paid ) && queryCheck ( hours_record . purpose ) && fromCheck ( hours_record . dateTime ) && toCheck ( hours_record . dateTime ) ) ; } ; return compiledFunc ; }
Complex filter function constructor.
Complex filter function constructor .