main-project/app/client/src/Components/Util/ViewHours.js
/*
          Populates the view table for hours, using the given list and filter function.
          If no filter is given, the default includes everything.
         */
Populates the view table for hours, using the given list and filter function.
If no filter is given, the default includes everything.
Populates the view table for hours using the given list and filter function . If no filter is given the default includes everything .
generateHoursRows(inputList, filter = _ => true) {
    let hoursSum = 0;
    const compiledList = [];
    for (let record of inputList) {
      if (filter(record)) {
        compiledList.push(
          <HoursRow
            key={record._id}
            date={new Date(record.dateTime).toLocaleString()}
            event={record.purpose}
            hours={record.hours}
            paid={record.paid}
          />
        );
        hoursSum += parseFloat(record.hours);
      }
    }
    this.setState({ totalHours: hoursSum });
    return compiledList;
  }
generateHoursRows ( inputList , filter = _ => true ) { let hoursSum = 0 ; const compiledList = [ ] ; for ( let record of inputList ) { if ( filter ( record ) ) { compiledList . push ( < HoursRow key = { record . _id } date = { new Date ( record . dateTime ) . toLocaleString ( ) } event = { record . purpose } hours = { record . hours } paid = { record . paid } / > ) ; hoursSum += parseFloat ( record . hours ) ; } } this . setState ( { totalHours : hoursSum } ) ; return compiledList ; }
Populates the view table for hours, using the given list and filter function.
Populates the view table for hours using the given list and filter function .