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

APS-1744 bug - fix multiple beds in room issue with excel seed job #2728

Merged

Conversation

danhumphreys-moj
Copy link
Contributor

No description provided.

@danhumphreys-moj danhumphreys-moj changed the title Bug/fix multiple beds in room issue with excel seed job APS-1744 bug - fix multiple beds in room issue with excel seed job Dec 18, 2024
@danhumphreys-moj danhumphreys-moj force-pushed the bug/fix-multiple-beds-in-room-issue-with-Excel-seed-job branch from 296a144 to 58d0839 Compare December 20, 2024 10:56
@danhumphreys-moj danhumphreys-moj marked this pull request as ready for review December 20, 2024 15:24
) : ExcelSeedJob {
private val log = LoggerFactory.getLogger(this::class.java)
private val questionCriteriaMapping = QuestionCriteriaMapping(characteristicRepository)
Copy link
Contributor

Choose a reason for hiding this comment

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

if we want this to be newly constructed on every run of the seed job this will need to be constructed when the seed job is executed e.g. in processDataFrame, and then 'passed around' to functions that need it

Copy link
Contributor Author

@danhumphreys-moj danhumphreys-moj Dec 20, 2024

Choose a reason for hiding this comment

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

Will revisit this when work is done to address APS-1757.

) : ExcelSeedJob {
private val log = LoggerFactory.getLogger(this::class.java)
private val questionCriteriaMapping = QuestionCriteriaMapping(characteristicRepository)
private lateinit var qCode: String
Copy link
Contributor

Choose a reason for hiding this comment

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

this shouldn't be a class instance variable to avoid concurrency issues

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will revisit this when work is done to address APS-1757.

@@ -83,13 +87,13 @@ class ApprovedPremisesRoomsSeedFromXLSXJob(
val beds = mutableListOf<BedEntity>()
for (i in 1..<dataFrame.columnsCount()) {
val roomAnswers = dataFrame.getColumn(i)
val bedNumber = roomAnswers[1].toString()
val roomCode = "$qCode - ${roomAnswers[0]}"
Copy link
Contributor

Choose a reason for hiding this comment

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

may be worth introducing a fun buildRoomCode(qCode,roomNumber) = "$qCode - $roomNumber" to reduce duplication

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will revisit this when work is done to address APS-1757.

Copy link
Contributor

@davidatkinsuk davidatkinsuk left a comment

Choose a reason for hiding this comment

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

LGTM, just a few minor comments

"1",
"2",
)
rows.addCharacteristics(3, mapOf("Is this room located on the ground floor?" to listOf(1, 2)))
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be really helpful/more readable if we added arg names when using addCharacteristics

Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be more readable like:

rows.addCharacteristics("Is this room located on the ground floor?", listOf("N","Y","Y"))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will revisit this when work is done to address APS-1757.


fun MutableList<String>.addCharacteristics(numberOfRooms: Int = 1, activeCharacteristics: Map<String, List<Int>> = emptyMap()) {
siteSurvey.questionToCharacterEntityMapping.keys.forEach { question ->
questionCriteriaMapping.questionToCharacterEntityMapping.keys.forEach { question ->
Copy link
Contributor

Choose a reason for hiding this comment

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

as discussed, propose copying all questions into a List in this class as an instance variable, and then referring to that here instead of questionCriteriaMapping.questionToCharacterEntityMapping.keys

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will revisit this when work is done to address APS-1757.

@danhumphreys-moj danhumphreys-moj force-pushed the bug/fix-multiple-beds-in-room-issue-with-Excel-seed-job branch from 19cc622 to 5dc6481 Compare December 20, 2024 16:24
@danhumphreys-moj danhumphreys-moj merged commit 9d85443 into main Dec 20, 2024
7 checks passed
@danhumphreys-moj danhumphreys-moj deleted the bug/fix-multiple-beds-in-room-issue-with-Excel-seed-job branch December 20, 2024 16:34
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.

2 participants