Skip to content

526 contrasting confirmation messages#571

Open
Kafui123 wants to merge 20 commits into
developmentfrom
526Contrasting_Confirmation_Messages
Open

526 contrasting confirmation messages#571
Kafui123 wants to merge 20 commits into
developmentfrom
526Contrasting_Confirmation_Messages

Conversation

@Kafui123

@Kafui123 Kafui123 commented Apr 2, 2026

Copy link
Copy Markdown

Fixes issue #526

Changes:

  • Fixed the issue where an error message was shown, but a successful flash confirmation still appeared afterward. Now the feedback is consistent... no mixed signals for the user.
  • Adjusted the logic so that success and failure states are clearly separated and reported correctly, instead of overlapping or triggering both paths.
  • Addressed the case where email sending could fail, but the form would still be created, which previously caused a misleading failure message even though the form existed.
  • Ensured that form creation and email sending happen within a single transaction block.

Testing:

  • Click on administration and then manage terms.
  • Select a valid term under any academic year.
  • Create a new labor status form and then click submit
  • If everything succeeded, no flash error message would appear
  • If the form got created, but no email was sent, the form would not get created.
Screenshot 2026-04-02 145031 Screenshot 2026-04-02 145042

@Kafui123 Kafui123 requested a review from Arohasina April 2, 2026 18:54
@JohnCox2211 JohnCox2211 self-requested a review April 9, 2026 18:11

@bakobagassas bakobagassas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing 6 test files ? I don't think most of those changes are necessary

@Kafui123

Copy link
Copy Markdown
Author

Why are we changing 6 test files ? I don't think most of those changes are necessary

I had to make those changes because they(the test files) were failing as a result of the new changes I added.

Comment thread app/logic/emailHandler.py Outdated
Comment thread app/static/js/laborStatusForm.js
Comment thread tests/code/test_adminManagement.py Outdated
Comment thread tests/code/test_adminManagement.py Outdated
Comment thread tests/code/test_adminManagement.py Outdated
Comment thread app/static/js/laborStatusForm.js
@Arohasina

Copy link
Copy Markdown
Contributor

Your tests now handle success cases, but could you consider adding an integration test for partial/full submission failure scenarios after you have added the fixes mentioned above?

Comment thread app/logic/statusFormFunctions.py
@Kafui123

Copy link
Copy Markdown
Author

Your tests now handle success cases, but could you consider adding an integration test for partial/full submission failure scenarios after you have added the fixes mentioned above?

Your tests now handle success cases, but could you consider adding an integration test for partial/full submission failure scenarios after you have added the fixes mentioned above?

Your tests now handle success cases, but could you consider adding an integration test for partial/full submission failure scenarios after you have added the fixes mentioned above?

Since the main change in this pr was to put everything inside a mainDB.atomic block so that a form would not get submitted if email sending fails i do not think that it would be necessary testing the mainDB.atomic() block since that is peewee's behavior.

@Arohasina Arohasina left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good !

@Kafui123 Kafui123 requested a review from MImran2002 May 1, 2026 16:30
formHistory = FormHistory.create( formID = lsf.laborStatusFormID,
historyType = "Labor Status Form",
overloadForm = None,
createdBy = creatorID,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the email.laborStatusFormSubmitted be here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the call is intentionally handled later in the flow. For overload forms, the email is triggered earlier on line 81 via email.LaborOverloadFormSubmitted(link) and for regular status forms, the emaila gets sent on line 91 after the FormHistory record is created.

Comment thread app/models/__init__.py Outdated
@@ -1,8 +1,9 @@
from app import app

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I know the rationale for this as working on init.py file affect most of the backend

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these lines to resolve a circular import issue where other files depended on the db instance from this file. At the time, those modules were being imported before the database had been properly initialized, which led to errors when accessing db. Importing the Flask app and initializing db with it ensured that the database instance was available when those modules were loaded.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is valid, there some local changes that I have to make to have the system up and running. But in those cases where usually it's the environment file unless explicitly stated by the issue i would keep it in the local change only instead of pushing it. So I am gonna go and revert it as pushing this through would not be compatible with other environment builds for other people. However, if its something that persists in your local change definitely save it on your end cause I have been in your situation and I saved mine in like a google doc.

@Kafui123 Kafui123 requested a review from MImran2002 May 5, 2026 19:20
@MImran2002 MImran2002 self-assigned this Jun 8, 2026

@MImran2002 MImran2002 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are whitespaces, some changes I will revert to reduce the code change scope that are not related to the issue description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants