Skip to content
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

Fix Organisation Agreement Issue #294

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

dan-tang-ssd
Copy link
Contributor

This PR is submitted to fix #293

Suspected that error occurred when user updated organisation details without signing the agreement.
I tried to replicate the same error in local env but failed.

I also tried to replicate this error in staging env with below steps, but failed too...

  • perform testing in staging env
  • use organisation "Demo Institution" for testing
    - update organisations.agreement_signed_at and organisations.signee_id to null in backend database
    • in front end "My Institution" page, change institution name from "Demo Institution" to "Demo Institution a", click "Save" button
    • no error occurred
  • cannot replicate same issue in staging env

As error cannot be replicated yet (or I do not know how to replicate it...), I am not sure whether we need this PR to fix it.

Anyway, this PR can be a reference for future.

Copy link

what-the-diff bot commented Oct 8, 2024

PR Summary

  • Enhanced Readability and Cleanliness
    Updated some parts of the code by removing unwanted spaces, particularly in the 'show', 'update', and 'exportAll' methods. This action has made the code easier to read and tidier.

  • Improved Clarity
    Included comments in the 'update' method to explain how the agreement signing procedure works. These added comments will make it easier for others to understand the logic behind the function.

  • Increased Precision
    Modified the validation process in the 'update' method for checking whether an agreement is signed. Instead of a basic true or false check, it now checks if the agreement is specifically 'null'. This makes the check more precise, ensuring a more accurate response from the function.

@dave-mills
Copy link
Member

Just getting to this review now.

The issue is Attempt to read property "agreement_signed_at" on null - Which means $organisation is null, and it doesn't have anything to do with the property agreement_signed_at.

Looking at the function, $organisation is defined with: $organisation = Organisation::find(Session::get('selectedOrganisationId'));

So the $organisation not being null relies on there being a session with a selectedOrganisationId.

Why might there not be a valid session? I can think of 2 possibilities:

  1. The logged in user is a member of multiple organisations and had not chosen an organisation yet (but somehow was able to send a request to update one)
  2. A back-end process triggered the update on a separate process to the main user session.

I don't think this is a high priority fix, though if it occurs more often we should address it.

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.

[BUG] ErrorException: Attempt to read property "agreement_signed_at" on null
2 participants