Fix call Statements
This commit is contained in:
parent
cb1758fb55
commit
4d21fbebf8
2 changed files with 24 additions and 19 deletions
|
|
@ -86,17 +86,22 @@ const formatCallDateTime = (callValue) => {
|
||||||
const getIncidents = async (departments, incidentStatus) => {
|
const getIncidents = async (departments, incidentStatus) => {
|
||||||
let response;
|
let response;
|
||||||
try {
|
try {
|
||||||
response = await fetch(`${process.env.EXPO_PUBLIC_DATABASE_URL}/getRecentCalls/${5}`, {
|
response = await fetch(`${process.env.EXPO_PUBLIC_DATABASE_URL}/getCallsParams`, {
|
||||||
method: "GET",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
apiKey: process.env.EXPO_PUBLIC_DATABASE_API_KEY
|
apiKey: process.env.EXPO_PUBLIC_DATABASE_API_KEY,
|
||||||
|
"Content-Type": 'application/json'
|
||||||
},
|
},
|
||||||
// body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
// callCount: 25,
|
numCalls: 25,
|
||||||
// departments,
|
departments,
|
||||||
// status: incidentStatus,
|
status: incidentStatus
|
||||||
// }),
|
}),
|
||||||
});
|
});
|
||||||
|
console.log('response: ', response);
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to fetch initial calls:", e);
|
console.error("Failed to fetch initial calls:", e);
|
||||||
}
|
}
|
||||||
|
|
@ -115,7 +120,7 @@ export const useCallFeed = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
const incidents = await getIncidents(InitList?.map((dept) => { return dept?.id }), selectedStatus?.id);
|
const incidents = await getIncidents(InitList?.map((dept) => { return dept?.deptId }), selectedStatus?.id);
|
||||||
setAllCalls(incidents);
|
setAllCalls(incidents);
|
||||||
setInit(false);
|
setInit(false);
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +138,7 @@ export const useCallFeed = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
const incidents = await getIncidents(InitList?.map((dept) => { return dept?.id }), selectedStatus?.id);
|
const incidents = await getIncidents(InitList?.map((dept) => { return dept?.deptId }), selectedStatus?.id);
|
||||||
setAllCalls(incidents);
|
setAllCalls(incidents);
|
||||||
}
|
}
|
||||||
if (!init) {
|
if (!init) {
|
||||||
|
|
@ -144,13 +149,13 @@ export const useCallFeed = () => {
|
||||||
const callColorSelector = (callAcuity, cardiacArrestCall, status) => {
|
const callColorSelector = (callAcuity, cardiacArrestCall, status) => {
|
||||||
if (status?.toLowerCase() === "closed") {
|
if (status?.toLowerCase() === "closed") {
|
||||||
return "#0000CD";
|
return "#0000CD";
|
||||||
} else if (CriticalCallList.includes(cardiacArrestCall)) {
|
} else if (CriticalCallList.some(critical => cardiacArrestCall.includes(critical))) {
|
||||||
return "#8B0000";
|
return "#8B0000";
|
||||||
} else if (HighCallList.includes(callAcuity)) {
|
} else if (HighCallList.some(high => callAcuity.includes(high))) {
|
||||||
return "#FF0000";
|
return "#FF0000";
|
||||||
} else if (MediumCallList.includes(callAcuity)) {
|
} else if (MediumCallList.some(medium => callAcuity.includes(medium))) {
|
||||||
return "#FF8C00";
|
return "#FF8C00";
|
||||||
} else if (LowCallList.includes(callAcuity)) {
|
} else if (LowCallList.some(low => callAcuity.includes(low))) {
|
||||||
return "#228B22";
|
return "#228B22";
|
||||||
}
|
}
|
||||||
return "grey";
|
return "grey";
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const departmentTypeMap = {
|
||||||
const accountDetails = {
|
const accountDetails = {
|
||||||
"CallThemes" : {
|
"CallThemes" : {
|
||||||
"CriticalCallList": [
|
"CriticalCallList": [
|
||||||
"CARDIAC ARREST|DEATH",
|
"CARDIAC ARREST"
|
||||||
],
|
],
|
||||||
"HighCallList": [
|
"HighCallList": [
|
||||||
"EMS ALS PRIORITY (ALS)",
|
"EMS ALS PRIORITY (ALS)",
|
||||||
|
|
@ -42,7 +42,7 @@ const accountDetails = {
|
||||||
},
|
},
|
||||||
"InitList": [
|
"InitList": [
|
||||||
{
|
{
|
||||||
deptId: 0,
|
deptId: 1,
|
||||||
dept: 'Darien EMS',
|
dept: 'Darien EMS',
|
||||||
addDepts: [
|
addDepts: [
|
||||||
'Darien EMS Supv'
|
'Darien EMS Supv'
|
||||||
|
|
@ -58,7 +58,7 @@ const accountDetails = {
|
||||||
hasVolunteer: true,
|
hasVolunteer: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
deptId: 1,
|
deptId: 2,
|
||||||
dept: 'Noroton Fire Department',
|
dept: 'Noroton Fire Department',
|
||||||
deptAbv: 'NFD',
|
deptAbv: 'NFD',
|
||||||
rank: 'Lieutenant',
|
rank: 'Lieutenant',
|
||||||
|
|
@ -71,8 +71,8 @@ const accountDetails = {
|
||||||
hasVolunteer: true,
|
hasVolunteer: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
deptId: 2,
|
deptId: 3,
|
||||||
dept: 'Stamford Fire Department',
|
dept: 'Stamford Fire Rescue',
|
||||||
deptAbv: 'SFD',
|
deptAbv: 'SFD',
|
||||||
rank: 'Paramedic',
|
rank: 'Paramedic',
|
||||||
rankAbv: 'EMT-P',
|
rankAbv: 'EMT-P',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue