Skip to content

feat: add export to excel functionality in reviewers and assignments tab in fap page - #1839

Open
Bhaswati1148 wants to merge 15 commits into
developfrom
1574-export-fap-reviewers-review
Open

Bhaswati1148 wants to merge 15 commits into
developfrom
1574-export-fap-reviewers-review

Conversation

@Bhaswati1148

Copy link
Copy Markdown
Contributor

Description

This PR adds the export to excel functionality in reviewers and assignments tab in fap page. The export creates multiple sheets if multiple users(reviewers) are selected.
The exported excel will have the columns : Proposal ID, Proposal title, Instrument, Date assigned, Rank, Grade, Comment, Status

Motivation and Context

This functionality has been added to allow the FAP Secretary in STFC to export reviewer reviews to Excel.

How Has This Been Tested

An E2E test has been added to verify the export functionality when the download button is clicked and to validate the contents of the exported Excel file.

Fixes

Closes UserOfficeProject/issue-tracker#1574

Changes

Depends on

Tests included/Docs Updated?

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

@Bhaswati1148
Bhaswati1148 requested a review from a team as a code owner September 28, 2026 14:21
@Bhaswati1148
Bhaswati1148 requested review from mutambaraf and removed request for a team September 28, 2026 14:21
@Bhaswati1148 Bhaswati1148 changed the title feat: add export to excel functionality in reviewers and assignments page feat: add export to excel functionality in reviewers and assignments tab in fap page Sep 28, 2026
.andWhere('call_id', callId);
.where('fap_id', fapId);

if (callId != 0) {

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.

Is there a legitimate case where callId is 0?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The callId is set to 0 when no calls are selected in the frontend.


cy.get('[data-cy="submit"]').click();

cy.notification({

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.

What's the motivation behind removing this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed the notification assertion because the success notification appears and disappears very quickly, and I couldn't find a reliable way for Cypress to get hold of it before it disappeared. This was making the test unreliable. The assignment itself is still verified by checking that the proposal appears in the FAP assignments table, so the test continues to validate the operation successfully.

return;
}
const reviewerProposalMap = new Map<number, number[]>();
// const reviewerIds = rowData.map((reviewer) => reviewer.user.userId);

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 these commented out lines please be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed them

});
const reviewerProposals = Object.fromEntries(reviewerProposalMap);
reviewerProposalMap.forEach((key, value) => {
console.log('reviewerid ' + key + `proposals ` + value);

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.

This logging can be removed now, I reckon.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed them

@mutambaraf mutambaraf 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.

LGTM apart form just a few comments

Comment on lines +144 to +146
const userWithRole = {
...res.locals.agent,
};

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.

We may need to validate we are getting all the information we need from this object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Id is the information we need from userWithRole object which will be used further in the process. The middleware effectively validates the user’s id, it reads req.user.user.id, looks up that user with getAgent(id), and returns an unauthorized response if no user is found. It then puts the resulting user data into res.locals.agent. So I believe a second id check in the XLSX handler would usually be redundant.

const reviewerProposalsParam = req.query.reviewerProposals;

if (typeof reviewerProposalsParam !== 'string') {
throw new Error('reviewerProposals is required');

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.

We can say Proposals reviewer is required

This branch has not been deployed

No deployments
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.

FAP sec to export one reviewers reviews

3 participants