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

Dev: #19452: Improve usage of getQuestionAttributes DataEntry #3784

Merged
merged 5 commits into from Mar 21, 2024

Conversation

Shnoulle
Copy link
Collaborator

@Shnoulle Shnoulle commented Mar 6, 2024

No description provided.

$qidattributes = [];
if (isset($fname['qid']) && isset($fname['type'])) {
$qidattributes = QuestionAttribute::model()->getQuestionAttributes($fname['qid']);
$qidattributes = QuestionAttribute::model()->getQuestionAttributes(Question::model()->findByPk($fname['qid']));
Copy link
Contributor

Choose a reason for hiding this comment

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

This is compatible with our goals of how we want to use getQuestionAttributes, that is, we intend to pass question objects rather than question ids to it, but let's load the questions separately in a single query rather than running an individual query for each question.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, maybe check if we call it multiple times ( same qid for subquestions).

Didn't get it in memory, just keep last qid done since we call sub question in a raw.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated : usage on question object in one another question.

application/controllers/admin/DataEntry.php Outdated Show resolved Hide resolved
…n::model()->findByPk( when it's neeed

Dev: not for other question, and not in other foreach
@@ -822,7 +827,7 @@ public function editdata($subaction, $id, $surveyid)
$questionInput .= ">{$optionarray['answer']}</option>\n";
}
}
if ($oQuestion->other == "Y") {
if (($oQuestion->other ?? "N") == "Y") {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Really ?

@kevin-foster-uk kevin-foster-uk merged commit 1f84686 into master Mar 21, 2024
20 checks passed
@kevin-foster-uk kevin-foster-uk deleted the bug/19452_questionAttribute_DataEntry branch March 21, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants