Git Product home page Git Product logo

logistics's Introduction

Metrics

logistics's People

Contributors

coteh avatar grigori-gru avatar imgbot[bot] avatar yevheniysolovey avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

logistics's Issues

Split driver task validator method into two, one for input validation and one for conflict checking

You can see here:

/**
* Validate a driver task
* @param args driver task information to be used for validation
* @remarks a future improvement to this validator would be to split this method into two, one for validation one for conflicts
* @returns result of driver task validation (ie. whether there's any validation errors or conflicts)
*/
public validateTaskEntry(args: DriverTaskArgs): DriverTaskValidationResult {
let userTasks: DriverTask[] = this.driverTaskRepo.getWeeklyTasksByUserID({
userID: args.userID,
startWeek: args.week,
endWeek: args.week,
ignoreIDs: args.ignoreIDs,
});
let conflictingTasks: DriverTask[] = userTasks.filter((task) => {
return (
args.day === task.day && args.start < task.end && task.start < args.end
);
});
return {
conflict: conflictingTasks.length > 0,
invalid: args.start >= args.end,
conflictingTasks:
conflictingTasks.length > 0 ? conflictingTasks : undefined,
};
}

that the "invalid" driver task check is just one small part of the function, and the rest of it checks for conflicting tasks. I think that this should be refactored so that there's one function that checks for validity of driver task and the other checks for whether driver tasks conflict with other tasks.

Update TSDoc comments and tests as well.

Fix inability to schedule between 11:00PM to 12:00AM

Small oversight when originally designing the scheduling system. Add ability to schedule between discrete times of 11 PM to 12 AM, but without it going into the next day. This would likely require a new discrete time value be added (25 since original requirement for discrete time was 1-24 IIRC) and can only be selected when selecting end time.

Fix test warning

src/App.spec.tsx
  โ— Console

    console.error
      Warning: An update to App inside a test was not wrapped in act(...).
      
      When testing, code that causes React state updates should be wrapped into act(...):
      
      act(() => {
        /* fire events that update state */
      });
      /* assert on the output */
      
      This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act
          in App (at App.spec.tsx:7)

      79 |       .getWeeklyUserTasks(selectedUserID, selectedWeek, loggedInUser)
      80 |       .then((res: DriverTask[]) => {
    > 81 |         setTasks(res);
         |         ^
      82 |       })
      83 |       .catch((err: ServiceError) => {
      84 |         console.log(err.message);

      at printWarning (node_modules/react-dom/cjs/react-dom.development.js:88:30)
      at error (node_modules/react-dom/cjs/react-dom.development.js:60:5)
      at warnIfNotCurrentlyActingUpdatesInDEV (node_modules/react-dom/cjs/react-dom.development.js:23284:7)
      at setTasks (node_modules/react-dom/cjs/react-dom.development.js:15656:9)
      at src/App.tsx:81:9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.