As a developer, I need to combine the different data already collected into excursion logs. These data sets will include Crew Members, Destinations, Environmental Data, Log entries, and Species.
AC
WHEN a developer looks at the data files
THEN they will also see data that is combining all 5 sections into one array, or data set.
DevNotes
Create a new file inside of the data folder, which is located in the helpers folder, called smashExcursions.js.
Main smash function will be called const getNewExcursion()
Inside of this smash function we will first define a new array called const newExcursion = [ ];
Next we will use a promise call from our excursionsData.js file targeting the ``const getAllExcursions``` function.
Inside of that promise call we will:
1) loop over the excursions.
2) Define a new object called const mission = { };
3) Take the data that we want from the promise call which is:
mission.name = excursion.name,```
We will then make a new promise call from our destinationsData.js file targeting the const getDestinationById function.
Inside of that promise call we will:
1) Take the data that we want from that promise call which is:
mission.destination = destination.name;
We will then make another promise call from our environmentsData.js file targeting the const getEnvironmentById function.
Inside of that promise call we will:
1) Take the data that we want from that promise call which is:
We will then make another promise call from speciesData.js file targeting the const getAllSpeciesNameByEnvironment function.
Inside of that promise call we will:
1) Take the data that we want from that promise call which is:
mission.speciesNames = species.name
We will then make another promise call from excursionCrew.js targeting the const getAllCrewMembersByExcursionId function.
Inside of that promise call we will:
1) Create an indexOn rule in firebase comparing excursionId to crewID.
2) Take the names of the crew members that come back with the matching excursionsId.
Now that we have all of our data that we need we need to take that object data and push it into our empty array that we defined earlier called const newExcursion
UserStory
AC
WHEN a developer looks at the data files THEN they will also see data that is combining all 5 sections into one array, or data set.
DevNotes
const getNewExcursion()
const newExcursion = [ ];
const mission = { };
3) Take the data that we want from the promise call which is:const getDestinationById
function.mission.destination = destination.name;
const getEnvironmentById
function.const getAllSpeciesNameByEnvironment
function.mission.speciesNames = species.name
const getAllCrewMembersByExcursionId
function.const newExcursion