Skip to content

Commit b70f3ec

Browse files
Merge pull request #4284 from OneCommunityGlobal/Mohan-fix-duplicate-time-logging
Mohan Fix app allowing logging of duplicate time entries
2 parents cd860d8 + f04388a commit b70f3ec

File tree

2 files changed

+160
-266
lines changed

2 files changed

+160
-266
lines changed

src/components/Timelog/TimeEntryForm/TimeEntryForm.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const customImageUploadHandler = () =>
6767
function TimeEntryForm(props) {
6868
/* ---------------- variables -------------- */
6969
// props from parent
70-
const { from, sendStop, edit, data, toggle, isOpen, tab, darkMode, userProfile, userProjects } = props;
70+
const { from, sendStop, edit, data, toggle, isOpen, tab, darkMode, userProfile, userProjects, timerConnected } = props;
7171
// props from store
7272
const { authUser } = props;
7373
const dispatch = useDispatch();
@@ -317,6 +317,13 @@ function TimeEntryForm(props) {
317317
};
318318

319319
const submitTimeEntry = async () => {
320+
// Prevent submission when logging timer time but timer is disconnected
321+
if (from === 'Timer' && timerConnected === false) {
322+
toast.error('Cannot log time entry while timer is disconnected. Please wait for connection to be restored or refresh the page.');
323+
setSubmitting(false);
324+
return;
325+
}
326+
320327
const { hours: formHours, minutes: formMinutes, personId, taskId } = formValues;
321328
const timeEntry = { ...formValues };
322329
const isTimeModified = edit && (initialHours !== formHours || initialMinutes !== formMinutes);
@@ -827,6 +834,7 @@ TimeEntryForm.propTypes = {
827834
isOpen: PropTypes.bool.isRequired,
828835
data: PropTypes.any.isRequired,
829836
handleStop: PropTypes.func,
837+
timerConnected: PropTypes.bool,
830838
};
831839

832840
const mapStateToProps = state => ({

0 commit comments

Comments
 (0)