-
Notifications
You must be signed in to change notification settings - Fork 438
time varying conversion/ frontend #1516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: timeVary
Are you sure you want to change the base?
time varying conversion/ frontend #1516
Conversation
…/hook_conversion_to_backend
…versionSegment route
…on conflict Signed-off-by: PRINCESANCHEZ <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to @minhtriet359, @evan-carey & @PRINCESANCHEZ for the updates. I'm sorry this took so long as I figured out what to do and my attention was taken elsewhere. I've made a few new comments and some from before are still not resolved. I tried to resolve everything that I think was complete. If you are willing to either address the comment or say it will not be done by any of you then that would be great. I can then resolve all I think are fine and figure out if the PR can be merged. I appreciate any efforts after you have graduated. Please let me know if anything is not clear or I can help.
I also should have said that there are now merge conflicts.
src/client/app/components/conversion/EditConversionModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/EditConversionModalComponent.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: PRINCESANCHEZ <[email protected]>
Signed-off-by: PRINCESANCHEZ <[email protected]>
Signed-off-by: PRINCESANCHEZ <[email protected]>
Signed-off-by: PRINCESANCHEZ <[email protected]>
…s and pages Signed-off-by: PRINCESANCHEZ <[email protected]>
Signed-off-by: PRINCESANCHEZ <[email protected]>
huss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to @PRINCESANCHEZ for the update. I have now reviewed the updated code and tried to test it more systematically now that it is generally working. I've made around 10 new comments and a similar number of unresolved comments remain. At this point would it be possible to put a comment on each one (done, unsure about, do not want to do, ....) so they can be resolved in some way.
There are also merge conflicts that need careful resolution. Please let me know if you want me to try to handle them.
I welcome any thoughts or questions. Also let me know if I can help in any way. This is getting fairly close.
src/client/app/components/conversion/EditConversionModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/EditConversionModalComponent.tsx
Outdated
Show resolved
Hide resolved
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I create a new conversion and then try to delete it, I see error message both in the web console and the terminal where I started OED. It has:
web-1 | [ERROR@2025-09-10T14:19:55.585+00:00] Unhandled Promise Rejection: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
web-1 | Stacktrace:
web-1 | Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
web-1 | at new NodeError (node:internal/errors:405:5)
web-1 | at ServerResponse.setHeader (node:_http_outgoing:648:11)
web-1 | at ServerResponse.header (/usr/src/app/node_modules/express/lib/response.js:795:10)
web-1 | at ServerResponse.send (/usr/src/app/node_modules/express/lib/response.js:175:12)
web-1 | at success (/usr/src/app/src/server/routes/response.js:16:3)
web-1 | at /usr/src/app/src/server/routes/conversions.js:199:3
web-1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
web-1 |
web-1 | (node:162) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 14)
The delete does not seem to happen (even though it is a success notification). I have not tried to figure out why.
| } | ||
|
|
||
| if (segment.endTime !== 'infinity' && next) { | ||
| const endMatches = moment.utc(segment.endTime, 'YYYY-MM-DD HH:mm:ss').isSame(moment.utc(next.startTime)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the end time of the edited segment must equal the start time of the next segment then it cannot be changed. If this is enforced then editing does not make sense. I think what is supposed to happen is that if you change the end time of the edited segment then the start time of the next segment must be changed to match that time. I believe this is what src/server/models/ConversionSegment.js does. However, the next segment's end time must be after the new start time. Effectively, the edited segment's end time must be before the next segment's end time. I think this is the desired check.
The same idea applies above for editing the start time.
I'm noting that I want to check if the start and end time of a segment can be edited once this is resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the logic so that editing a segment’s end or start time now also updates the neighboring segment accordingly. Added validation checks to enforce that the new end time is after the start, and the new start time is before the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting server/DB errors when I violate the rule rather than client notices. Do you see this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was unable to reproduce this. When I enter invalid or overlapping start/end times and click save, no request is sent in the network tab, and the validation error shows in the modal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should discuss this to figure out what I am seeing as I saw it again.
src/client/app/components/conversion/EditConversionSegmentModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/SplitConversionSegmentModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/SplitConversionSegmentModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/SplitConversionSegmentModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/SplitConversionSegmentModalComponent.tsx
Outdated
Show resolved
Hide resolved
|
I forgot to sweep all previous non-GitHub conversation records to make sure everything was resolved. Here are the few items I found that were not:
|
Signed-off-by: PRINCESANCHEZ <[email protected]>
…required attrs Signed-off-by: PRINCESANCHEZ <[email protected]>
Signed-off-by: PRINCESANCHEZ <[email protected]>
Signed-off-by: PRINCESANCHEZ <[email protected]>
huss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to @PRINCESANCHEZ for quickly making updates to address my recent comments. I've updated a couple of comments and made a few new ones to consider. I have not yet looked at the ones with issues you are encountering.
I would also like to know if anyone on the team plans to address the remaining unresolved comments or if OED needs to find others to do this? Any thoughts or comments would be appreciated.
src/client/app/components/conversion/EditConversionSegmentModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/SplitConversionSegmentModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/SplitConversionSegmentModalComponent.tsx
Outdated
Show resolved
Hide resolved
src/client/app/components/conversion/SplitConversionSegmentModalComponent.tsx
Show resolved
Hide resolved
| } | ||
|
|
||
| if (segment.endTime !== 'infinity' && next) { | ||
| const endMatches = moment.utc(segment.endTime, 'YYYY-MM-DD HH:mm:ss').isSame(moment.utc(next.startTime)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting server/DB errors when I violate the rule rather than client notices. Do you see this?
…to-adjust Signed-off-by: PRINCESANCHEZ <[email protected]>
Signed-off-by: PRINCESANCHEZ <[email protected]>
Signed-off-by: PRINCESANCHEZ <[email protected]>
Signed-off-by: PRINCESANCHEZ <[email protected]>
huss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to @PRINCESANCHEZ for addressing more comments. I've made a few small comments to consider. I also noted it might be good to discuss the one error I am seeing but you are not.
I still want to understand the remaining unresolved items to figure out how to finalize this PR. Any insights would be appreciated.
| }, | ||
| originalStartTime: previous.startTime, | ||
| originalEndTime: previous.endTime | ||
| }).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OED uses .then in the current code so I think that should be followed. Applies below too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use .then/.catch for consistency
| } | ||
|
|
||
| if (segment.endTime !== 'infinity' && next) { | ||
| const endMatches = moment.utc(segment.endTime, 'YYYY-MM-DD HH:mm:ss').isSame(moment.utc(next.startTime)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should discuss this to figure out what I am seeing as I saw it again.
| <td>{segment.startTime} to {segment.endTime}</td> | ||
| <td>{(segment.weekPatternsId ?? -99) === -99 ? segment.slope : ''}</td> | ||
| <td>{(segment.weekPatternsId ?? -99) === -99 ? segment.intercept : ''}</td> | ||
| <td>{weekPatterns.find(wp => wp.id === segment.weekPatternsId)?.name ?? 'No Pattern'}</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that this is not translated. All the drop down menus for this do translate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to use translation string
src/client/app/components/conversion/SplitConversionSegmentModalComponent.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: PRINCESANCHEZ <[email protected]>
Description
Finished implementing the UI changes required for the time-varying conversion feature (required backend changes are also included in this PR).
Fixes #896
Type of change
(Check the ones that apply by placing an "x" instead of the space in the [ ] so it becomes [x])
Checklist
(Note what you have done by placing an "x" instead of the space in the [ ] so it becomes [x]. It is hoped you do all of them.)
Limitations
(Describe any issues that remain or work that should still be done.)