Skip to content

Merge pull request #1 from Helen-con/codex/create-digital-sdq-assessm… - #3

Merged
Helen-con merged 4 commits into
codex/create-digital-sdq-assessment-questionnairefrom
main
Oct 25, 2025
Merged

Merge pull request #1 from Helen-con/codex/create-digital-sdq-assessm…#3
Helen-con merged 4 commits into
codex/create-digital-sdq-assessment-questionnairefrom
main

Conversation

@Helen-con

Copy link
Copy Markdown
Owner

…ent-questionnaire

Add interactive SDQ assessment interface

…ent-questionnaire

Add interactive SDQ assessment interface

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

sdqDIGITAL/script.js

Lines 87 to 91 in 7ff18c0

function init() {
totalQuestionsEl.textContent = questions.length.toString();
renderQuestion();
attachEventListeners();
}

P0 Badge Invoke init() so questionnaire is usable

The new script defines an init() function that populates the first question and wires up all event handlers, but nothing ever calls it. In the previous version the questionnaire was rendered immediately, whereas now the file ends after the function definition. Without invoking init() the page never renders response options or attaches listeners, so the assessment cannot be used at all.


sdqDIGITAL/script.js

Lines 73 to 85 in 7ff18c0

const questionTextEl = document.getElementById('question-text');
const currentQuestionEl = document.getElementById('current-question');
const totalQuestionsEl = document.getElementById('total-questions');
const progressFillEl = document.querySelector('.progress__bar-fill');
const progressBarEl = document.querySelector('.progress__bar');
const formEl = document.getElementById('response-form');
const prevBtn = document.getElementById('prev-btn');
const nextBtn = document.getElementById('next-btn');
const generateBtn = document.getElementById('generate-btn');
const exportBtn = document.getElementById('export-btn');
const resultsSection = document.getElementById('results');
const resultsGrid = document.getElementById('results-grid');
const resultsAnalysis = document.getElementById('results-analysis');

P0 Badge Fix DOM id mismatches used for element lookups

The refactor switched all JavaScript selectors to kebab‑case ids (question-text, response-form, results, etc.), but the HTML still exposes camelCase ids (questionText, responseForm, resultsSection). When renderQuestion() runs it will attempt to access questionTextEl.textContent where questionTextEl is null, throwing a TypeError before any question renders. Align the ids or selectors so the script can find the DOM nodes.


sdqDIGITAL/script.js

Lines 101 to 134 in 7ff18c0

nextBtn.addEventListener('click', () => {
if (!isCurrentQuestionAnswered()) {
formEl.classList.add('question__options--error');
formEl.setAttribute('data-error', 'Please select an option before continuing.');
return;
}
if (state.currentIndex < questions.length - 1) {
state.currentIndex += 1;
renderQuestion();
}
});
formEl.addEventListener('change', (event) => {
if (event.target && event.target.name === 'response') {
const value = Number(event.target.value);
state.responses[state.currentIndex] = value;
formEl.classList.remove('question__options--error');
formEl.removeAttribute('data-error');
updateNavigationState();
}
});
generateBtn.addEventListener('click', () => {
if (!areAllQuestionsAnswered()) {
alert('Please answer all questions before generating results.');
return;
}
const scores = calculateScores();
renderResults(scores);
resultsSection.hidden = false;
resultsSection.scrollIntoView({ behavior: 'smooth' });
exportBtn.disabled = false;
});

P1 Badge Provide implementations for referenced helper functions

The event handlers rely on helper functions such as isCurrentQuestionAnswered, areAllQuestionsAnswered, updateNavigationState, calculateScores, and renderResults, but none of these functions exist in the file anymore. As soon as a navigation or generate button is clicked, the first call to one of these names will raise ReferenceError and the flow halts. Reintroduce these helpers or remove the calls.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Helen-con
Helen-con merged commit c6ab783 into codex/create-digital-sdq-assessment-questionnaire Oct 25, 2025
2 checks passed
Helen-con added a commit that referenced this pull request Oct 25, 2025
…ent-questionnaire

Merge pull request #3 from Helen-con/main
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.

1 participant