Web Client - Survey End Time Can Come Before Start Time

Bug #1879517 reported by Jennifer Pringle
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
3.9
Fix Released
Medium
Unassigned

Bug Description

Evergreen 3.5

The new angular survey interface (Administration -> Local Administration -> Surveys) allows you to enter an end time that comes before the start time for the survey. Ideally Evergreen should stop you from creating a survey that finished before it starts.

The Survey End Date/Time field comes before the Survey Start Date/Time when creating or editing a survey which lends itself to people entering the opposite dates by accident (https://bugs.launchpad.net/evergreen/+bug/1879514).

Changed in evergreen:
importance: Undecided → Medium
status: New → Confirmed
Mike Risher (mrisher)
Changed in evergreen:
assignee: nobody → Mike Risher (mrisher)
Revision history for this message
Mike Risher (mrisher) wrote :

The surveys have been modified so that the start date is listed before the end date. Also, if one enters an end date that comes before the start date an error is raised on the form and the save button is disabled.

Note that part of the changes involve adding a new "FmFieldOption" to fm-editor called "isDataValid"

Ready for testing. Branch here:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/mrisher/lp1879517-start-end-date-error

Changed in evergreen:
assignee: Mike Risher (mrisher) → nobody
tags: added: pullrequest
Revision history for this message
Kyle Huckins (khuckins) wrote :

This required a minor rebase for the latest master, I've pushed up a rebased branch here: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/khuckins/lp1879517-start-end-date-error-rebase

Revision history for this message
Dawn Dale (ddale) wrote :

I have tested this code and consent to sign off with my name, Dawn Dale and email address ddale @georgialibraries.org.

Kyle Huckins (khuckins)
tags: added: signedoff
Changed in evergreen:
milestone: none → 3.6.3
Changed in evergreen:
milestone: 3.6.3 → 3.6.4
Changed in evergreen:
milestone: 3.6.4 → 3.7.2
Changed in evergreen:
milestone: 3.7.2 → 3.7.3
no longer affects: evergreen/3.6
Changed in evergreen:
milestone: 3.7.3 → none
Changed in evergreen:
assignee: nobody → Jane Sandberg (sandbergja)
Changed in evergreen:
milestone: none → 3.9.1
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Thank you for your code, Mike and Kyle! It works well, but I have a concern that the isDataValid structure is essentially duplicating the existing validation features in Angular.

I've been playing with an alternative patch that uses the existing validation features: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/sandbergja/lp1879517_alternative_patch . It's not quite there (I tried to set a default end date in the future, but couldn't figure out how...), but hopefully it at least demonstrates the alternative approach.

Revision history for this message
Jane Sandberg (sandbergja) wrote :

My alternative patch is now ready for review -- let me know what you think!

Changed in evergreen:
assignee: Jane Sandberg (sandbergja) → nobody
tags: removed: signedoff
Revision history for this message
Susan Morrison (smorrison425) wrote :

When adding an end date before a start date, an alert does pop up notifying of the error, but I could still save the survey and add questions and answers.

Also, a couple funny things happen when trying to edit the survey with the incorrect date range (end date before start date). These may be irrelevant since ideally a survey with the wrong date range would not be saved but:

When editing a survey with an incorrect date range (end before start), when pulling up the edit screen, the dates revert to the default instead of what was chosen upon saving the survey. I did confirm that if I didn't touch the dates, made some other changes, and then clicked Save, the dates stayed as I originally input them.

When I do update the dates, an alert will pop up if my new end date is before the original start date, even if it's after the updated start date. When I save, it autocorrects the end date to be before the original start date, even if it's incorrect/still before the end date. And the original start date did not change based on the edit. Attached a couple screenshots to show when I tried to edit and the resulting dates.

Revision history for this message
Susan Morrison (smorrison425) wrote :
Revision history for this message
Susan Morrison (smorrison425) wrote :
Changed in evergreen:
milestone: 3.9.1 → 3.9.2
Changed in evergreen:
assignee: nobody → Jane Sandberg (sandbergja)
Revision history for this message
Jennifer Pringle (jpringle-u) wrote :

Testing for bug squashing week I cannot create a survey at all. No matter what I do I get "Failed to Create New Survey"

I also can't edit the existing survey. It tells me Update Succeeded but it doesn't actually save my changes.

I tried with a Local Administrator account as well as with the global admin account.

Revision history for this message
Jane Sandberg (sandbergja) wrote :

removing pullrequest, since I need to go back to the drawing board.

tags: removed: pullrequest
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Should be ready for review again! Adding pullrequest back.

tags: added: pullrequest
Changed in evergreen:
assignee: Jane Sandberg (sandbergja) → nobody
Revision history for this message
Blake GH (bmagic) wrote :

All,

This patch caused Evergreen to break. After applying the patch, the Evergreen database couldn't get new rows created. Postgres complains about having null values on non-null columns. The test I used was creating a new Org Unit. This is the Postgres log message:

ERROR: null value in column "shortname" violates not-null constraint

INSERT INTO actor.org_unit (billing_address,holds_address,id,ill_address,mailing_address,name,ou_type,parent_ou,shortname,email,phone,opac_visible,fiscal_calendar) VALUES (DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,2,1,DEFAULT,DEFAULT,DEFAULT,'f',1);

I'm not exactly sure what part of this patch causes this cascading issue.

I'm using this patch:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/sandbergja/lp1879517_alternative_patch

Revision history for this message
Jane Sandberg (sandbergja) wrote :

Force pushed a fix so that it doesn't break all of Evergreen! Sorry, Blake!!!!! But thanks for the report.

Revision history for this message
Susan Morrison (smorrison425) wrote :

Looks great to me. I can no longer save/create a survey if the end date is before the start date, and the alert pops up as expected.

I have tested this code and consent to signing off on it with my name, Susan Morrison,
and my email address, <email address hidden>.

tags: added: signedoff
Changed in evergreen:
milestone: 3.9.2 → 3.10.2
Revision history for this message
Jason Boyer (jboyer) wrote :

I'd like to see this have customizable error messages but it does the thing and that can be addressed later. Pushed to rel_3_9 and up. Thanks Jane and Susan!

Changed in evergreen:
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.