File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
main/java/org/broadinstitute/consent/http/service
test/java/org/broadinstitute/consent/http/service Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,8 @@ private void processDarCollectionSummariesForChair(List<DarCollectionSummary> su
276276 s -> {
277277 Map <String , Integer > statusCount = new HashMap <>();
278278 Map <Integer , Election > elections = s .getElections ();
279- if (!s .requiresSOApproval () && elections .size () < s .getDatasetCount ()) {
279+ if ((!s .requiresSOApproval () || s .getSOApprover () != null )
280+ && elections .size () < s .getDatasetCount ()) {
280281 s .addAction (DarCollectionActions .OPEN );
281282 }
282283 elections
@@ -310,7 +311,8 @@ private void updateSummaryActionsForChair(
310311 }
311312
312313 // If there are no elections, only show open
313- if (!summary .requiresSOApproval () && summary .getElections ().isEmpty ()) {
314+ if ((!summary .requiresSOApproval () || summary .getSOApprover () != null )
315+ && summary .getElections ().isEmpty ()) {
314316 summary .addAction (DarCollectionActions .OPEN );
315317 }
316318
Original file line number Diff line number Diff line change @@ -1700,6 +1700,28 @@ void testProcessDarCollectionSummariesForChairWithSOApprovalRequired() {
17001700 assertTrue (summaries .getFirst ().getActions ().isEmpty ());
17011701 }
17021702
1703+ @ Test
1704+ void testProcessDarCollectionSummariesForChairWithSOApprovalRequired_And_Granted () {
1705+ User user = new User ();
1706+ user .setUserId (1 );
1707+ user .addRole (UserRoles .Chairperson ());
1708+ DarCollectionSummary summary = new DarCollectionSummary ();
1709+ summary .setLatestReferenceId (UUID .randomUUID ().toString ());
1710+ summary .setRequiresSOApproval (true );
1711+ summary .setSOApprover (1 );
1712+ summary .addDatasetId (1 );
1713+ when (darCollectionSummaryDAO .getDarCollectionSummariesForDACRole (
1714+ user .getUserId (), UserRoles .CHAIRPERSON .getRoleId ()))
1715+ .thenReturn (List .of (summary ));
1716+
1717+ List <DarCollectionSummary > summaries = service .getSummariesForRole (user , UserRoles .CHAIRPERSON );
1718+
1719+ assertNotNull (summaries );
1720+ assertEquals (1 , summaries .size ());
1721+ // Chair summary have the open action after it is approved by the SO.
1722+ assertTrue (summaries .getFirst ().getActions ().contains (DarCollectionActions .OPEN .getValue ()));
1723+ }
1724+
17031725 @ Test
17041726 void testGetSummaryForRoleByCollectionId_SO () {
17051727 User user = new User ();
You can’t perform that action at this time.
0 commit comments