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

[Visits Architecture (2 of 4)] - Making config.xml unnecessary #7729

Merged
merged 3 commits into from
Oct 28, 2021

Conversation

ridz1208
Copy link
Collaborator

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

@ridz1208 ridz1208 added Cleanup PR or issue introducing/requiring at least one clean-up operation Critical to release PR or issue is key for the release to which it has been assigned labels Oct 19, 2021
Comment on lines -93 to -110
$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);
}
Copy link
Collaborator Author

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
        )
)

Copy link
Collaborator Author

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

Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

correct and correct

@ridz1208 ridz1208 force-pushed the visits_SQL_too_sequel branch from ac7af02 to 9f81d8b Compare October 21, 2021 13:25
@jesscall jesscall self-assigned this Oct 21, 2021
@ridz1208 ridz1208 force-pushed the visits_SQL_too_sequel branch from 5f8a138 to c0fa8b0 Compare October 21, 2021 23:29
@jesscall jesscall added the Passed manual tests PR has been successfully tested by at least one peer label Oct 22, 2021
Copy link
Contributor

@xlecours xlecours left a 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.

@@ -0,0 +1,167 @@
<?php
Copy link
Collaborator

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

@xlecours
Copy link
Contributor

Also, there seems to be overlaps with #7502. Depending on the order of the merges, we will have to rebase.

@ridz1208 ridz1208 force-pushed the visits_SQL_too_sequel branch from c0fa8b0 to b5c9228 Compare October 25, 2021 17:59
@ridz1208
Copy link
Collaborator Author

@driusan rebased and changelog updated. All yours

Copy link
Collaborator

@driusan driusan left a 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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- 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";
Copy link
Collaborator

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.

@ridz1208 ridz1208 force-pushed the visits_SQL_too_sequel branch from b5c9228 to 3808f8f Compare October 27, 2021 18:45
@ridz1208 ridz1208 force-pushed the visits_SQL_too_sequel branch from 3808f8f to c3bc879 Compare October 28, 2021 13:26
@ridz1208 ridz1208 requested a review from driusan October 28, 2021 13:31
@driusan driusan merged commit 67a6078 into aces:main Oct 28, 2021
@ridz1208 ridz1208 added this to the 24.0.0 milestone Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cleanup PR or issue introducing/requiring at least one clean-up operation Critical to release PR or issue is key for the release to which it has been assigned Passed manual tests PR has been successfully tested by at least one peer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants