This repository has been archived by the owner on May 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added merge possibilities for steps and delete case handle
- Loading branch information
Charles Capelli
committed
Feb 20, 2020
1 parent
1b3833b
commit 6bcc03e
Showing
6 changed files
with
22 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import { | ||
CREATED, | ||
DELIVERED, | ||
STARTED, VALIDATED, | ||
} from '../../models/status'; | ||
import { DEPARTURE, ARRIVAL } from './types'; | ||
import Step from './schema'; | ||
import { isToday } from '../date-helpers'; | ||
|
||
export default (ride) => { | ||
const steps = []; | ||
if (ride.status !== DELIVERED) { | ||
steps.push(new Step(ARRIVAL, ride)); | ||
|
||
const shouldGenerateDualStep = ride.status === VALIDATED || ride.status === STARTED; | ||
if (ride.status !== DELIVERED && isToday(ride.start)) { | ||
const shouldGenerateDualStep = ride.status === CREATED || ride.status === VALIDATED || ride.status === STARTED; | ||
if (shouldGenerateDualStep) { | ||
steps.push(new Step(DEPARTURE, ride)); | ||
} | ||
steps.push(new Step(ARRIVAL, ride)); | ||
} | ||
return steps; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters