Skip to content

Commit

Permalink
Merge pull request #10 from ministryofjustice/add-status-to-fdc-selec…
Browse files Browse the repository at this point in the history
…tion

Changed FDC selection to restrict to SENT rows
  • Loading branch information
dconneely authored Jan 16, 2025
2 parents c86c109 + c6cf430 commit 89f4e3f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
!**/src/main/**/*.log
!**/src/test/**/*.log

*_premigconcor-*.csv

### Exclude .run run configurations - may contain confidential env-vars.
.run/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public int[] removeExisting(final Collection<CaseMigration> caseMigrations) {
FROM case_migration
""", rs -> {
final var caseMigration = CaseMigration.ofPrimaryKey(rs.getLong(1), rs.getLong(2), rs.getLong(3));
++counts[0];
++counts[0]; // total
if (caseMigrations.remove(caseMigration)) {
++counts[1];
++counts[1]; // removed
}
});
return counts; // size of case_migration table, duplicates between caseMigrations parameter and database table.
Expand All @@ -89,9 +89,9 @@ public List<CaseMigration> renumberBatchIds(Collection<CaseMigration> caseMigrat
renumbered.add(caseMigration); // has a batch_id already.
} else {
if (caseMigration.concorContributionId() > 0) {
renumbered.add(caseMigration.withBatchId((counts[0]++) / CONCOR_BATCH_ID_DIVISOR));
renumbered.add(caseMigration.withBatchId((counts[0]++) / CONCOR_BATCH_ID_DIVISOR)); // concors
} else {
renumbered.add(caseMigration.withBatchId((counts[1]++) / FDC_BATCH_ID_DIVISOR));
renumbered.add(caseMigration.withBatchId((counts[1]++) / FDC_BATCH_ID_DIVISOR)); // fdcs
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void addLatestIdsByMaatIds(final List<Long> maatIds, final Collection<Cas
foundFdcs.addAll(maat.sql("""
SELECT MAX(id), rep_id
FROM togdata.fdc_contributions
WHERE rep_id IN (:maatIds)
WHERE rep_id IN (:maatIds) AND status = 'SENT'
GROUP BY rep_id
""")
.paramSource(paramSource)
Expand Down

0 comments on commit 89f4e3f

Please sign in to comment.