Feat(2632): Update organization statistics section - #2651
Conversation
rukundo-kevin
commented
Jul 30, 2026
- add data from last entry when it loads
- disabled dates without lessons.
- Show a message when there is not data
- add data from last entry when it loads - disabled dates without lessons. - Show a message when there is not data
| private | ||
|
|
||
| def populate_lesson_activity | ||
| @available_lesson_dates = GroupLessonSummary.where(chapter_id: @organization.chapters).distinct.pluck(:lesson_date).sort |
There was a problem hiding this comment.
This is slow because you are using GroupLessonSummary when you can just query lessons since all you need are the dates. Just make sure you don't query deleted lessons.
There was a problem hiding this comment.
Tried this but ended up reverting it. Turns out GroupLessonSummary only counts a date if a student was actually enrolled in that group at the time — it's not just "lessons that aren't deleted" like the raw Lesson table. Querying them separately caused some orgs to default to a date with no data, and some dates were selectable but showed nothing. Pulling both from the same GroupLessonSummary relation now (just loading it once with .to_a) so they can't get out of sync.
| const parts = [date.getFullYear(), ('0'+(date.getMonth()+1)).slice(-2), ('0'+date.getDate()).slice(-2)]; | ||
| return parts.join("-"); | ||
| } | ||
| const enabledDates = this.hasEnabledDatesValue && this.enabledDatesValue.length > 0 ? new Set(this.enabledDatesValue) : null |
There was a problem hiding this comment.
Remove the length check here, if an organization had 0 lessons this would result in all dates being selectable.
- pass number_of_lessons/total_data_points from the controller instead of computing them in the component - fix datepicker enabling all dates when an organization has zero lessons - keep available lesson dates and lesson summaries sourced from the same GroupLessonSummary relation, so we don't default to (or enable) a date with no actual data - remove redundant enabled-dates feature spec
a076c7d to
77da419
Compare