Repository navigation
feat: add getAddMinutesExpression database-agnostic helper - #63
Merged
Merged
Conversation
MySQL: column + INTERVAL n MINUTE. SQLite: datetime(column, '+n minutes'). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld
buzz-code
pushed a commit
to buzz-code/react-admin-nestjs
that referenced
this pull request
Oct 6, 2026
…rt_date) index - teacher_reported_today: replace local sqlite check with shared helper (MySQL SQL unchanged). Bumps server/shared to nra-server claude/add-minutes-expression (buzz-code/nra-server#63); re-point to merged main before merging. - att_user_report_date_idx: the view and other date-range reports filter by user + report_date; only a user_id index existed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Negative minute values generate an invalid SQLite modifier and return NULL.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds a database-agnostic SQL helper for minute-based datetime arithmetic.
Changes:
- Adds MySQL and SQLite expression generation.
- Adds dialect-specific unit tests.
| File | Description |
|---|---|
utils/entity/column-types.util.ts |
Adds the datetime arithmetic helper. |
utils/entity/__tests__/column-types.util.spec.ts |
Tests SQLite and MySQL output. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…xpression on SQLite datetime() truncates fractional seconds, and '+-15 minutes' is invalid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld
buzz-code
pushed a commit
to buzz-code/react-admin-nestjs
that referenced
this pull request
Oct 7, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld
buzz-code
added a commit
to buzz-code/react-admin-nestjs
that referenced
this pull request
Oct 7, 2026
…missing-girls total (#204) * Align DB schema with TypeORM entities teacher_reported_today view column order and attendance_cleanup_rules lesson_id/klass_id nullability + active column type, so migration:generate reports no drift. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld * Teacher reported today: card per lesson taught, per-lesson hour, fix missing-girls total - missingGirlsCount comes from MySQL COUNT as a string; cast to Number so the card total sums instead of concatenating ("012") and a zero badge is hidden. - View now has one row per lesson taught: reports of the same teacher+lesson+klass+date are split into separate lessons when more than 15 minutes pass between consecutive reports. Works for phone, web form and Excel reports alike. - reportHour is the first report time of that lesson. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld * Use shared getAddMinutesExpression and add att_reports (user_id, report_date) index - teacher_reported_today: replace local sqlite check with shared helper (MySQL SQL unchanged). Bumps server/shared to nra-server claude/add-minutes-expression (buzz-code/nra-server#63); re-point to merged main before merging. - att_user_report_date_idx: the view and other date-range reports filter by user + report_date; only a user_id index existed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld * Bump server/shared: getAddMinutesExpression keeps milliseconds on SQLite Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld * Bump server/shared to nra-server main (buzz-code/nra-server#63 merged) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds
getAddMinutesExpression(column, minutes)toutils/entity/column-types.util.ts, next togetConcatExpressionandgetGroupConcatExpression:column + INTERVAL n MINUTEstrftime('%Y-%m-%d %H:%M:%f', column, '+n minutes'). It usesstrftimewith%finstead ofdatetime()so milliseconds are kept, and negative values become'-n minutes'.The change only adds a new export, so no
CONSUMER_CHANGES.mdrow is needed.First consumer is the
teacher_reported_todayview in buzz-code/react-admin-nestjs#204, which splits reports into lessons by gaps between report times. Using the helper replaces a hand-rolleddatabaseConfig.type === 'sqlite'check in that project.Testing
column-types.util.spec.tscover both dialects and negative minutes. The MySQL branch is tested via an isolated module with a mockeddatabaseConfig.09:00:00.100+ 15 min =09:15:00.100, and-15subtracts.react-admin-nestjsserver suite against this branch: 1171/1171 pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01Po2GocBhFneXD2k9z1f6Ld