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

On teacher feedback review state change, reload progress bubbles on page #41708

Merged
merged 12 commits into from
Aug 11, 2021

Conversation

maureensturgeon
Copy link
Contributor

@maureensturgeon maureensturgeon commented Jul 22, 2021

  • Creates a new endpoint to query data for teacher panel
  • Replaces TeacherPanelProgress bubble with ProgressBubble
  • When feedback review state is changed by teacher, progress is updated (for header and teacher panel progress bubbles)
Screen.Recording.2021-07-22.at.5.01.12.PM.mov

Links

Testing story

Deployment strategy

Follow-up work

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@maureensturgeon maureensturgeon force-pushed the maureen/LP-1898-keep-working-progress branch from 2318c4c to 3ea8b94 Compare July 28, 2021 20:51
@maureensturgeon maureensturgeon marked this pull request as ready for review July 28, 2021 22:58
assert_response :forbidden
end

# test "" do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missing test?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ooops, will remove this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind just removing this test for me so we can avoid having to coordinate commits?

script_level = script.script_levels.find do |sl|
sl.level_ids.include?(params[:level_id].to_i)
end
return head :bad_request if script_level.nil?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it worth returning some kind of message describing the issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm thinking no? This would be mostly for debugging purposes and it seems like this would be easy enough to diagnose with just the error code? (famous last words)

Copy link
Contributor

@jamescodeorg jamescodeorg left a comment

Choose a reason for hiding this comment

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

Wow, this looks like a huge step forward!

I need to take another pass, but posting some initial comments.

@@ -126,40 +77,48 @@ export class SelectedStudentInfo extends React.Component {
/>
<div style={styles.studentInfo}>
<div style={styles.name}>{selectedStudent.name}</div>
{userLevel.paired && (
{levelWithProgress?.paired && (
Copy link
Contributor

Choose a reason for hiding this comment

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

In what scenarios do we have / not have a levelWithProgress object? What is shown when levelWithProgress is not present? (I'm wondering whether it would make sense to split that out as a specific case because all of these elements are shown only if levelWithProgress being present.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that level/progress data is being loaded async, there is a moment while data is loading when this value will be undefined. However, the student data is available on load so we can immediately show the student name which is why this component is rendered. We could wait until the level data is loaded to render this component, I don't have a strong opinion.

if (this.props.userLevels) {
url = this.props.userLevels[0].bonus
let url;
if (this.props.levelsWithProgress?.length) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, when will this.props.levelsWithProgress be undefined/null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When level/progress data is being loaded.

assert_response :forbidden
end

# test "" do
Copy link
Contributor

Choose a reason for hiding this comment

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

Ooops, will remove this.

@@ -262,6 +265,13 @@ export default function reducer(state = initialState, action) {
};
}

if (action.type === SET_RELOAD_TEACHER_PANEL_PROGRESS) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you elaborate a bit on why we need this value in redux? Is there a scenario where we need to re-render but redux-managed state doesn't change? (Usually, we just update the underlying data and the appropriate components re-renders, right?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right - we're not storing the teacher panel bubble data in redux, it's stored in the TeacherPanel component state, since that's the only component that needs to know about the data. However when a teacher makes a change in the feedback component we need to communicate to the TeacherPanel component that it needs to refresh it's data so that's what's happening here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok, I think I understand now. Do we use this pattern anywhere else? (This feels potentially simpler than putting the data in redux but it also feels a bit non-standard.) Let's chat tomorrow.

Copy link
Contributor

@jamescodeorg jamescodeorg left a comment

Choose a reason for hiding this comment

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

I think I understand this change now. Let's chat tomorrow and see if we can wrap this up! :-)

(Sorry for the off-hours review, I'm working slightly strange hours this week.)

viewAs === ViewType.Teacher && sectionData && sectionData.level_examples;

const displayLockInfo =
hasSections && unitHasLockableLessons && viewAs === ViewType.Teacher;
Copy link
Contributor

Choose a reason for hiding this comment

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

(very minor) Maybe move the viewAs condition to be the first in the list to be more consistent with the other two checks above? That should make it clear that all of these only apply to ViewType.Teacher.

We probably don't want to fix this now, but I'm also wondering how sectionData relates to hasSections (i.e. can one be derived from the other)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created this ticket https://codedotorg.atlassian.net/browse/LP-1987, there are still many aspects of the teacher panel logic and how data is included that are confusing, hopefully I'll get a chance to address some of this there.

@@ -262,6 +265,13 @@ export default function reducer(state = initialState, action) {
};
}

if (action.type === SET_RELOAD_TEACHER_PANEL_PROGRESS) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok, I think I understand now. Do we use this pattern anywhere else? (This feels potentially simpler than putting the data in redux but it also feels a bit non-standard.) Let's chat tomorrow.

@@ -18,7 +18,8 @@ module.exports = {
(item.type === 'ExportDefaultDeclaration' &&
item.declaration.type === 'ClassDeclaration') ||
(item.type === 'ExportNamedDeclaration' &&
item.declaration?.type === 'ClassDeclaration')
item.declaration &&
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was getting some linting errors related to this.. just going to clean that up so it doesn't happen to anyone else.

Copy link
Contributor

@jamescodeorg jamescodeorg left a comment

Choose a reason for hiding this comment

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

Yay!

@maureensturgeon maureensturgeon merged commit 2ec7ff7 into staging Aug 11, 2021
@maureensturgeon maureensturgeon deleted the maureen/LP-1898-keep-working-progress branch August 11, 2021 23:59
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.

None yet

2 participants