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

[create_timepoint] Fix type errors in timepoint creation #9361

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions modules/create_timepoint/php/timepoint.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class Timepoint extends \NDB_Page implements ETagCalculator
if ($num_sites == 1) {
$site = \Site::singleton($user_list_of_sites[0]);
} else if ($num_sites > 1) {
$site = \Site::singleton(\CenterID::singleton(($values['psc'])));
$site = \Site::singleton(\CenterID::singleton((intval($values['psc']))));
}

// Project
Expand All @@ -161,7 +161,7 @@ class Timepoint extends \NDB_Page implements ETagCalculator
// if there is only one project, autoselect first project from array of 1
$project = \Project::getProjectFromID(array_pop($user_list_of_projects));
} else if (count($user_list_of_projects) > 1) {
$project_id = \ProjectID::singleton($values['project']);
$project_id = \ProjectID::singleton(intval($values['project']));
$project = \Project::getProjectFromID($project_id);
}

Expand Down Expand Up @@ -234,7 +234,9 @@ class Timepoint extends \NDB_Page implements ETagCalculator
null : $values['psc'];

// validate site entered
$site = !empty($values['psc']) ? \CenterID::singleton($values['psc']) : null;
$site = !empty($values['psc'])
? \CenterID::singleton(intval($values['psc']))
: null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you indent these two lines?

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 indentation came from npm run lintfix:php.. I just tried to manually indent it and it looks like PHPCS doesn't complain, so sure.


$user_list_of_sites = $user->getCenterIDs();
$num_sites = count($user_list_of_sites);
Expand All @@ -261,7 +263,7 @@ class Timepoint extends \NDB_Page implements ETagCalculator

$candid = $values['candID'];
$cohortID = intval($values['cohort']);
$projectID = \ProjectID::singleton($values['project']);
$projectID = \ProjectID::singleton(intval($values['project']));

//Visit - Get all visits to map ID back to label for session table
$visits = \Utility::getVisitsForProjectCohort(
Expand Down
Loading