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

feat: assign statuses to Xpress proposals #848

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

simonfernandes
Copy link
Contributor

@simonfernandes simonfernandes commented Nov 7, 2024

Description

This PR allows user officers and scientists to change statuses on Xpress proposals.

User Officers can change the instrument and status without any restrictions.

Scientists have a set of conditions that determine whether they can set the instrument and status. For example, they can only change an instrument when the status is Under Review, and once the status moves to Finished, the status and instrument are locked in place.

The changes in this PR are mainly for the statuses, but the instrument logic has been adjusted slightly to account for the current status. There are also a couple of minor changes to only show Xpress calls and statuses in the dropdown filters.

GMT20241107-143404_Recording_2560x1380.mp4

Motivation and Context

Both scientists and user officers need to be able to change the status of Xpress proposals. For scientists this needs to be limited and take into account the current status and instrument.

Changes

  1. Updated 'ProposalDataSource.ts' to map the statusId to all proposals.
  2. Added new tests in 'InstrumentMutations.spec.ts' to ensure that the feature works as expected, including scenarios where a user officer can change the instrument of an Xpress proposal from any status, a scientist cannot change the instrument of an Xpress proposal from any status, a scientist can change the instrument of an Xpress proposal when the status is under review, etc.
  3. Updated 'InstrumentMutations.ts' to inject 'ProposalSettingsDataSource' to allow the status of Xpress proposals to be manipulated.

How Has This Been Tested?

  • Manual testing
  • Backend mutation tests
  • e2e tests

Fixes Jira Issue

Resolves UserOfficeProject/issue-tracker#1138

Depends On

Tests included/Docs Updated?

  • I have added tests to cover my changes.
  • All relevant doc has been updated

@simonfernandes simonfernandes requested a review from a team as a code owner November 7, 2024 14:44
@simonfernandes simonfernandes requested review from mehta-pooja123 and removed request for a team November 7, 2024 14:44
@simonfernandes simonfernandes removed the request for review from mehta-pooja123 November 7, 2024 14:59
@simonfernandes simonfernandes requested review from mutambaraf, a team, martin-trajanovski and bolmsten and removed request for a team and martin-trajanovski November 7, 2024 16:18
@simonfernandes
Copy link
Contributor Author

@UserOfficeProject/swap Martin was automatically assigned and I wasn't sure who to replace him with, so I have just assigned Fredrik for now 🙂

@yoganandaness yoganandaness self-requested a review November 8, 2024 08:41
@yoganandaness
Copy link
Contributor

@UserOfficeProject/swap Martin was automatically assigned and I wasn't sure who to replace him with, so I have just assigned Fredrik for now 🙂

I am adding myself as the reviewer as well.

@@ -517,6 +516,165 @@ export default class ProposalMutations {
return result || rejection('Can not change proposal status', { result });
}

@EventBus(Event.PROPOSAL_STATUS_CHANGED_BY_USER)
@Authorized([Roles.USER_OFFICER])
async changeProposalsStatus(
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont see this is referenced by resolver or any other place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Git shows this as a new addition, but this is unchanged from before and the resolver still exists. The implementation for it is now moved to a private function processProposalsStatusChange so that both this mutation changeProposalsStatus and the Xpress one changeXpressProposalsStatus can use it without duplication.

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

Successfully merging this pull request may close these issues.

Scientists should be able to change statuses on Xpress proposals
2 participants