-
Notifications
You must be signed in to change notification settings - Fork 481
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
[CFU] Add initial free response summary page #50606
Conversation
Very cool that we were able to add the "X/Y students submitted"! If you change the section in the dropdown, does the entire page reload or does it fetch new student submissions asynchronously? |
I'm just reloading the entire page, at least for now, because it's easier to pass in the responses from the HAML. If we wanted to change it to load responses via ajax, we could set up a new API endpoint for that. And yeah, the 5/5 was a manual edit I did just for the screenshot, there are actually only 2 students in this section 😅. |
Yeah, don't worry about loading responses via ajax for now. Thanks! Looks great so far :) |
So it doesn't apply to all tests in all files.
<textarea | ||
className={styles.freeResponse} | ||
id={`level_${data.level.id}`} | ||
aria-label={i18n.yourAnswer()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't love this aria-label
, but I couldn't think of a way to do a visible label that made sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better this than nothing!
// To avoid confusion, if a teacher tries to view the summary as a student, | ||
// send them back to the level in Participant mode instead. | ||
if (viewAs === ViewType.Participant) { | ||
const paramString = document.location.search | ||
.replace(SUMMARY_PARAM, '') | ||
.replace('&&', '&') | ||
.replace('?&', '?'); | ||
document.location.replace(currentLevel.url + paramString); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels messy, but I wasn't sure a better way that handled all the cases (url?view=summary
, url?otherParams=blah&view=summary&moreParams=blah
, etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm interested in how a student would get into this case- would they have to type the url in manually? And this seems fine to me- I think in an ideal world (or maybe a later version?) we would have some sort of feedback/alert in red. Aside from that though, leaving them on the same level seems fine (instead of sending them back to the url they came from, which then might allow us to avoid writing them a new url).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a student tries to visit the url, it just looks like this:
I figured it didn't matter, at least for the MVP, because there aren't any links to this page that a student would see.
I agree that an alert like the existing redirect warning if you try to visit an old version of a course, would be ideal.
<label> | ||
{i18n.responsesForClassSection()} | ||
<SectionSelector reloadOnChange={true} /> | ||
</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately, the SectionSelector
doesn't have an id
, so I have to wrap the label instead of using a for
attribute
} | ||
end | ||
|
||
teacher_markdown = if level.respond_to?(:solution) && level.solution.present? && Policies::InlineAnswer.visible_for_script_level?(current_user, @script_level) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this respond_to?
just makes it so the page doesn't crash if you try to view a non-free-response level in the summary view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Some comments but none blocking. Additionally- is there a way we could test the case where a non-teacher tries to access this page? Thanks for getting all the A11y and translation work in on draft1.
const FREE_RESPONSE = 'FreeResponse'; | ||
|
||
const CheckForUnderstanding = ({ | ||
isRtl, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad this is included in V1:)
// To avoid confusion, if a teacher tries to view the summary as a student, | ||
// send them back to the level in Participant mode instead. | ||
if (viewAs === ViewType.Participant) { | ||
const paramString = document.location.search | ||
.replace(SUMMARY_PARAM, '') | ||
.replace('&&', '&') | ||
.replace('?&', '?'); | ||
document.location.replace(currentLevel.url + paramString); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm interested in how a student would get into this case- would they have to type the url in manually? And this seems fine to me- I think in an ideal world (or maybe a later version?) we would have some sort of feedback/alert in red. Aside from that though, leaving them on the same level seems fine (instead of sending them back to the url they came from, which then might allow us to avoid writing them a new url).
|
||
const questionMarkdown = data.level.properties.long_instructions; | ||
const teacherMarkdown = data.teacher_markdown; | ||
const height = data.level.height || '80'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 80 a min height? Or default height? Would it ever change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this one, I copied this from the haml. The textarea can be resized, and I assume that there's somewhere in the levelbuilder editor that lets curriculum writers set this property?
)} | ||
</p> | ||
|
||
{/* Question Title */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment labels here!
<textarea | ||
className={styles.freeResponse} | ||
id={`level_${data.level.id}`} | ||
aria-label={i18n.yourAnswer()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better this than nothing!
id={`level_${data.level.id}`} | ||
aria-label={i18n.yourAnswer()} | ||
placeholder={ | ||
data.level.properties.placeholder || i18n.enterYourAnswerHere() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would there a way to get a screen reader to read out this string instead? But then to your point- having it labeled as 'your answer' is helpful context too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i could reuse this for the label, but I didn't think it made as much sense, since it's intended for the placeholder. this could be weird if curriculum designers write something important as a placeholder though 🙃
}; | ||
|
||
export default connect( | ||
// NOTE: Some of this state data is loaded in by the teacher panel. If you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
border-bottom: unset; | ||
} | ||
|
||
p, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity- how does this syntax work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comma selectors say to style "any of these": https://developer.mozilla.org/en-US/docs/Web/CSS/Selector_list
expect(wrapper.find('SectionSelector option').length).to.eq(2); | ||
}); | ||
|
||
it('applies correct classes when rtl', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌🏼
level ||= if @level.contained_levels.empty? | ||
@level | ||
else | ||
@level.contained_levels.first | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
important fix to support contained levels
For posterity, some notes on CFU implementation as of this writing: Most of the code is in a new folder: There is a new Try not to expose the raw content of the The summary view defaults to using answers from contained levels, whenever a contained level exists. The code for this is in the script_levels controller, if that ever needs to change. Gotchas:
Want to refactor:
Multi implementation notes:
|
Oops, this is my bad :P |
Add an initial implementation of the "Check for Understanding" or "summary" view for free response levels.
When reviewing the JSX component, it may help to compare it with the free response files I copied this code from:
I'm not tied to the file/folder names I'm using here, so feel free to suggest different ones. I intentionally didn't refactor out components for free-response-specific things or reusable pieces, since we wanted to get Free Response out and in front of people first for feedback.
Outdated screenshot with more student answers
Links
Testing story
Manual testing in LTR and RTL languages.