Skip to content

Conversation

@jansenk
Copy link
Contributor

@jansenk jansenk commented Nov 5, 2025

This PR adds the prompts to the ora grading screen.

In order to do so, I needed to fix the way we were loading the prompts from redux state, along with testing.
We were treating it as a single string, but actually it's being stored as a list of objects with the text in a "description" key:

Screenshot 2025-11-05 at 3 12 01 PM

For the prompt, I had behavior diverge when there is one vs multiple prompts. For one prompt, I added the prompt as a dropdown at the top of the screen, above the file uploads.

##Existing:
Screenshot 2025-11-05 at 10 34 24 AM

##New, open/collapsed
Screenshot 2025-11-05 at 3 23 43 PM
Screenshot 2025-11-05 at 3 23 50 PM

For multiple prompts, the prompt is included at the top of the text response to that prompt. I also added some padding between text submissions to improve the overall look.

##existing
Screenshot 2025-11-05 at 10 34 14 AM

##New, open / collapsed
Screenshot 2025-11-05 at 1 45 50 PM
Screenshot 2025-11-05 at 1 45 59 PM

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.90%. Comparing base (bc4abcd) to head (ae365b6).

Files with missing lines Patch % Lines
src/containers/ResponseDisplay/PromptDisplay.jsx 92.30% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##            master     #471      +/-   ##
===========================================
- Coverage   100.00%   99.90%   -0.10%     
===========================================
  Files          107      108       +1     
  Lines         1086     1106      +20     
  Branches       160      164       +4     
===========================================
+ Hits          1086     1105      +19     
- Misses           0        1       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the ORA (Open Response Assessment) data model to support multiple prompts instead of a single prompt. The change updates the API documentation, Redux state management, selectors, and UI components to handle an array of prompts with descriptions.

Key changes:

  • Updated oraMetadata structure from a single prompt string to a prompts array of objects with description fields
  • Modified Redux selectors to extract and map prompt descriptions from the array
  • Enhanced ResponseDisplay component to conditionally render single or multiple prompts with appropriate UI components

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/data/services/lms/api.js Updated API documentation comment to reflect prompts instead of prompt
src/data/redux/app/selectors.js Changed selector from prompt to prompts with mapping logic to extract descriptions
src/data/redux/app/selectors.test.js Updated test data and assertions to use prompts array structure
src/data/redux/app/reducer.js Changed initial state from prompt: '' to prompts: []
src/data/redux/app/reducer.test.js Updated test expectations for new prompts array structure
src/containers/ResponseDisplay/index.jsx Added prompt display logic with single/multiple prompt handling and refactored HTML formatting
src/containers/ResponseDisplay/index.test.jsx Added tests for single and multiple prompt display scenarios
src/containers/ResponseDisplay/messages.js Added internationalization message for prompt collapsible header
src/containers/ResponseDisplay/PromptDisplay.jsx New component file with SinglePromptDisplay and MultiplePromptDisplay components
src/containers/ResponseDisplay/ResponseDisplay.scss Added styling for single and multiple prompt displays

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@nsprenkle nsprenkle left a comment

Choose a reason for hiding this comment

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

Design nit: I'm not sure why a separate design is needed for single / multi-prompt. I also have some critiques / questions:

  1. Why do the single / multi-prompt headers use different colors / expand arrow placement? They should probably be the same.
  2. The multi-prompt design with prompt collapsed makes it look like the response is the prompt. Either keeping the same separated Prompt <br> Response design or explicitly labelling the response might make that clearer.

Comment on lines +49 to +53
formattedHtml(text) {
const cleanedText = text.replaceAll(/\.\.\/asset/g, `${getConfig().LMS_BASE_URL}/asset`);
return parse(this.purify.sanitize(cleanedText));
}

Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: this is technically a sanitizedHtml function. No?

const multiPrompt = prompts.length > 1;
return (
<div className="response-display">
{!multiPrompt && <SinglePromptDisplay prompt={prompts[0]} />}
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: add a comment as to why this styling changes.

Suggested change
{!multiPrompt && <SinglePromptDisplay prompt={prompts[0]} />}
/* For single prompt ORAs, display the prompt at the top of the page */
{!multiPrompt && <SinglePromptDisplay prompt={prompts[0]} />}

Comment on lines +36 to +39
* Returns the ORA Prompts
* @return {array[string]} - ORA prompt
*/
prompt: oraMetadataSelector(data => data.prompt),
prompts: oraMetadataSelector(data => (data.prompts ? data.prompts.map((oraPrompt) => oraPrompt.description) : [])),
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this require backend changes? If so, can you link them?

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.

3 participants