Merge pull request 'dev/nicolas/staging-prep' (#64) from dev/nicolas/staging-prep into main
Reviewed-on: Targo/targo_frontend#64
This commit is contained in:
commit
7b56a14cb4
|
|
@ -15,7 +15,7 @@ export const ShiftService = {
|
||||||
|
|
||||||
createNewShifts: async (new_shifts: Shift[], employee_email?: string):Promise<BackendResponse<Shift>> => {
|
createNewShifts: async (new_shifts: Shift[], employee_email?: string):Promise<BackendResponse<Shift>> => {
|
||||||
if (employee_email) {
|
if (employee_email) {
|
||||||
const response = await api.post(`/shift/create/${employee_email}`);
|
const response = await api.post(`/shift/create/${employee_email}`, new_shifts);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ export const ShiftService = {
|
||||||
|
|
||||||
updateShifts: async (existing_shifts: Shift[], employee_email?: string):Promise<BackendResponse<Shift>> => {
|
updateShifts: async (existing_shifts: Shift[], employee_email?: string):Promise<BackendResponse<Shift>> => {
|
||||||
if (employee_email) {
|
if (employee_email) {
|
||||||
const response = await api.patch(`/shift/update/${employee_email}`);
|
const response = await api.patch(`/shift/update/${employee_email}`, existing_shifts);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,13 @@ export const getMinutes = (hours: number) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getHoursMinutesStringFromHoursFloat = (hours: number): string => {
|
export const getHoursMinutesStringFromHoursFloat = (hours: number): string => {
|
||||||
const flat_hours = Math.floor(hours);
|
let flat_hours = Math.floor(hours);
|
||||||
const minutes = Math.round((hours - flat_hours) * 60);
|
let minutes = Math.round((hours - flat_hours) * 60);
|
||||||
|
|
||||||
|
if (minutes === 60) {
|
||||||
|
flat_hours += 1;
|
||||||
|
minutes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return `${flat_hours}h${minutes > 1 ? ' ' + minutes : ''}`
|
return `${flat_hours}h${minutes > 1 ? ' ' + minutes : ''}`
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user