-
Notifications
You must be signed in to change notification settings - Fork 0
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
Keep lesson ids of all selections #224
Conversation
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.
Ziemlich übler Bug, ich frage mich was mir damals durch den Kopf ging. Danke fürs Fixen.
.reduce((acc, lessonIds) => { | ||
return acc.concat(lessonIds); | ||
}, []) | ||
) |
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.
Kleine Kosmetik:
Du loopst mit dem map
und dem reduce
zweimal über alle Einträge. Ich würde das in diesem Fall einfach in einem Schritt machen:
map((selectedIds) =>
selectedIds
.reduce((acc, s) => [...acc, ...s.lessonIds], [])
)
Eine Alternative wäre flatten zu verwenden:
map((selectedIds) => uniq(flatten(selectedIds.map(s => s.lessonIds))))
Sollte nicht zusätzlich auch ein uniq gemacht werden, damit diese Lektionen nicht mehrfach vorkommen?
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.
Danke. Ich habe das nun so umgesetzt (für alle drei Fälle).
.reduce((acc, lessonIds) => { | ||
return acc.concat(lessonIds); | ||
}, []) | ||
) |
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.
Gleiches Thema wie oben.
.reduce((acc, lessonIds) => { | ||
return acc.concat(lessonIds); | ||
}, []) | ||
) |
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.
Und auch hier das gleiche Thema.
376145f
to
443f64e
Compare
443f64e
to
763bcb3
Compare
Nicht nur die erste Selection verwenden um die LessonIds zu ermitteln, sondern alle.
Würdest du das noch in eine Hilfsmethode oder so auslagern?