-
Notifications
You must be signed in to change notification settings - Fork 175
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
[Visits Architecture (2 of 4)] - Making config.xml unnecessary #7729
Conversation
$visit_options = []; | ||
$visitLabelSettings = $config->getSetting('visitLabel'); | ||
foreach ( | ||
\Utility::associativeToNumericArray($visitLabelSettings) as $visitLabel | ||
) { | ||
if (!empty($values['subproject'])) { | ||
$visitLabel = \Utility::associativeToNumericArray($visitLabel)[0]; | ||
$labelOptions = []; | ||
$items = \Utility::associativeToNumericArray( | ||
$visitLabel['labelSet']['item'] | ||
); | ||
foreach ($items as $item) { | ||
$item = \Utility::associativeToNumericArray($item)[0]; | ||
$labelOptions[$item['@']['value']] = $item['#']; | ||
} | ||
$visit_options[$visitLabel['@']['subprojectID']] | ||
= array_filter($labelOptions); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code returned an array of the following format:
Array
(
[1] => Array
(
[V1] => V1
[V2] => V2
[V3] => V3
)
[2] => Array
(
[V1] => V1
[V2] => V2
[V3] => V3
)
[3] => Array
(
[V3] => V3
[V4] => V4
[V5] => V5
[V6] => V6
)
[4] => Array
(
[V3] => V3
[V4] => V4
[V5] => V5
[V6] => V6
)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new code should match the same format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the top level array indexes the subprojectids?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xlecours yes, I believe so. The subprojectID / visits defined matches with config.xml file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct and correct
ac7af02
to
9f81d8b
Compare
5f8a138
to
c0fa8b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only issue I see is that \Utility::getVisitsForSubproject($subprojectID)
do not take into account the project. If subprojectX in projectA has different visits than subprojectX in projectB then it will return a Set of all the defined visits. This function will not be usable to provide a list of visit label while doing something like create_timepoint.
tools/single_use/populate_visits.php
Outdated
@@ -0,0 +1,167 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rebase? Part 1 is merged so this shouldn't be showing up in the diff, not sure what's actually part of this PR and what isn't..
Also, there seems to be overlaps with #7502. Depending on the order of the merges, we will have to rebase. |
c0fa8b0
to
b5c9228
Compare
@driusan rebased and changelog updated. All yours |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo and one unnecessary change, otherwise looks good.
CHANGELOG.md
Outdated
@@ -98,17 +98,20 @@ requesting a new account and will be displayed in the User Accounts module (PR # | |||
- Fix fatal errors in delete_candidate.php tool. (PR #6805, #7275) | |||
- Fix fatal errors in fix_candidate_age.php (PR #7546) | |||
- New tool generate_candidate_externalids.php to fill external IDs for all candidates where a NULL value is found. (PR #7095) | |||
- New tool to backpopulate visits fro mthe `config.xml`, `session` table and `Visit_Windows` table into the `visit` and `visit_project_subproject_rel` (#7663) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- New tool to backpopulate visits fro mthe `config.xml`, `session` table and `Visit_Windows` table into the `visit` and `visit_project_subproject_rel` (#7663) | |
- New tool to backpopulate visits from the `config.xml`, `session` table and `Visit_Windows` table into the `visit` and `visit_project_subproject_rel` (#7663) |
require_once 'generic_includes.php'; | ||
require_once 'Database.class.inc'; | ||
require_once 'Utility.class.inc'; | ||
require_once __DIR__ . "/../generic_includes.php"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why this is moved/changed.
b5c9228
to
3808f8f
Compare
3808f8f
to
c3bc879
Compare
Brief summary of changes
This PR removes the need for the visits-subprojects association to be defined in config.xml. as we are trying to slowly phase out config.xml and since the dataabase already has a place for this data, all references to
getSetting("VisitLabel")
were removed and replaced by the appropriate and equivalent code.Note: this PR contains changes from #7663