Skip to content

Commit

Permalink
No longer load the previous pulse.
Browse files Browse the repository at this point in the history
  • Loading branch information
ocielliottc committed Jan 7, 2025
1 parent 6817a6f commit c76a4c2
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions web-ui/src/pages/PulsePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { format } from 'date-fns';
import React, { useContext, useEffect, useState } from 'react';
import { useHistory } from 'react-router-dom';
import { Button, Checkbox, Typography } from '@mui/material';
import { downloadData, initiate } from '../api/generic.js';
import { initiate } from '../api/generic.js';
import Pulse from '../components/pulse/Pulse.jsx';
import { AppContext } from '../context/AppContext';
import { selectCsrfToken, selectCurrentUser } from '../context/selectors';
Expand Down Expand Up @@ -54,39 +54,6 @@ const PulsePage = () => {
center : pulse.externalScore - 1);
}, [pulse]);

const loadTodayPulse = async () => {
if (!csrf || !currentUser?.id) return;

const query = {
dateFrom: today,
dateTo: today,
teamMemberId: currentUser.id
};

const res = await downloadData(pulseURL, csrf, query);
if (res.error) return;

// Sort pulse responses by date, latest to earliest
const pulses = res.payload.data?.sort((a, b) => {
const l = a.submissionDate;
const r = b.submissionDate;
if (r[0] == l[0]) {
if (r[1] == l[1]) {
return r[2] - l[2];
} else {
return r[1] - l[1];
}
} else {
return r[0] - l[0];
}
});
setPulse(pulses.at(0));
};

useEffect(() => {
loadTodayPulse();
}, [csrf, currentUser]);

const submit = async () => {
const myId = currentUser?.id;
const data = {
Expand Down

0 comments on commit c76a4c2

Please sign in to comment.