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

RM- Debugging Missing CSS #1419

Merged
merged 8 commits into from
Feb 12, 2025
Merged

RM- Debugging Missing CSS #1419

merged 8 commits into from
Feb 12, 2025

Conversation

Diama1
Copy link
Collaborator

@Diama1 Diama1 commented Feb 11, 2025

Copy link
Collaborator

@anvmn anvmn left a comment

Choose a reason for hiding this comment

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

Can't use ??

@@ -431,143 +431,86 @@ function hedley_admin_administrators_access() {
* This function generates a table displaying the resilience survey results.
*/
function hedley_admin_resilience_survey_results_table(array $form, array &$form_state) {
$header = array(
drupal_add_css('.align-center { text-align: center; }', ['type' => 'inline']);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move to end of funciton


$survey_answers = explode('|', $survey_answers_raw);
$answers_processed = [];
if (empty($result['node'])) return [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

where are {} ?

if (count($parts) === 2) {
list($question, $answer) = $parts;
$question_number = str_replace('q', '', $question);
foreach (node_load_multiple(array_keys($result['node'])) as $node) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not best styling. Hard to read. First load nodes, then run loop.

$question_number = str_replace('q', '', $question);
foreach (node_load_multiple(array_keys($result['node'])) as $node) {
$nurse_id = field_get_items('node', $node, 'field_nurse')[0]['target_id'] ?? NULL;
$nurse_name = $nurse_id ? (node_load($nurse_id)->title ?? 'Unknown Nurse') : 'Unknown Nurse';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, too much in one row. Separate for better readability.
Also ?? is php 8 operator. We're using php 7. Can't use it.

$nurse_node = node_load($nurse_id);
if ($nurse_node) {
$health_center_id = field_get_items('node', $nurse_node, 'field_health_centers')[0]['target_id'] ?? NULL;
$health_center_name = $health_center_id ? (node_load($health_center_id)->title ?? 'Unknown Center') : 'Unknown Center';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, too much in one row. Separate for better readability.
Also ?? is php 8 operator. We're using php 7. Can't use it.


if ($question_number >= 1 && $question_number <= 12) {
$answers_processed["question_$question_number"] = $answer;
$survey_type = field_get_items('node', $node, 'field_resilience_survey_type')[0]['value'] ?? 'Unknown';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't use ??

if ($question_number >= 1 && $question_number <= 12) {
$answers_processed["question_$question_number"] = $answer;
$survey_type = field_get_items('node', $node, 'field_resilience_survey_type')[0]['value'] ?? 'Unknown';
$date_measured = field_get_items('node', $node, 'field_date_measured')[0]['value'] ?? 'Unknown';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't use ??

}

$form_state['rows'] = $rows;
$form['csv_export_button'] = ['#type' => 'submit', '#value' => t('Export to CSV'), '#submit' => ['hedley_admin_resilience_survey_export_csv']];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't be single line. Revert.

}

$form_state['rows'] = $rows;
$form['csv_export_button'] = ['#type' => 'submit', '#value' => t('Export to CSV'), '#submit' => ['hedley_admin_resilience_survey_export_csv']];
$form['table'] = ['#theme' => 'table', '#header' => $header, '#rows' => $rows, '#empty' => t('No survey results available')];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't be single line. Revert.

@anvmn
Copy link
Collaborator

anvmn commented Feb 12, 2025

@Diama1

Coder failure:

Selection_1193

@anvmn anvmn merged commit ffcc9c4 into issue-1400 Feb 12, 2025
4 checks passed
@anvmn anvmn deleted the issue-1400-debug branch February 12, 2025 18:55
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