Skip to content

RE1-T46 Fixing bug with action logs query.#295

Merged
ucswift merged 3 commits intomasterfrom
develop
Mar 11, 2026
Merged

RE1-T46 Fixing bug with action logs query.#295
ucswift merged 3 commits intomasterfrom
develop

Conversation

@ucswift
Copy link
Member

@ucswift ucswift commented Mar 11, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Corrected internal mappings used by action log queries so the correct user table is referenced across views.
    • Fixed an identifier mapping used when retrieving action logs to prevent incorrect or missing log entries and ensure users are accurately associated with their logs.

@request-info
Copy link

request-info bot commented Mar 11, 2026

Thanks for opening this, but we'd appreciate a little more information. Could you update it with more details?

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e48be10a-9d4b-4f93-aedd-5960f973ac86

📥 Commits

Reviewing files that changed from the base of the PR and between 740e602 and 354b251.

📒 Files selected for processing (4)
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectActionLogsByCallIdQuery.cs
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectActionLogsByUserIdQuery.cs
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectLastActionLogByUserIdQuery.cs
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectPerviousActionLogsByUserQuery.cs
🚧 Files skipped from review as they are similar to previous changes (3)
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectActionLogsByUserIdQuery.cs
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectLastActionLogByUserIdQuery.cs
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectPerviousActionLogsByUserQuery.cs

📝 Walkthrough

Walkthrough

Replaced %USERSTABLE% with %ASPNETUSERSTABLE% in several ActionLogs query builders and corrected a malformed %ACTIONLOGID%ACTIONLOGID% placeholder in SelectPerviousActionLogsByUserQuery. Only placeholder tokens and minor using/whitespace edits changed; no public signatures or logic flows altered.

Changes

Cohort / File(s) Summary
ASPNET user table placeholder
Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectActionLogsByCallIdQuery.cs, Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectActionLogsByUserIdQuery.cs, Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectLastActionLogByUserIdQuery.cs
Replaced %USERSTABLE% with %ASPNETUSERSTABLE% in query construction/replacement arrays so the ASP.NET user table placeholder is used for joins/replacements.
ActionLog ID placeholder & minor cleanup
Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectPerviousActionLogsByUserQuery.cs
Fixed malformed %ACTIONLOGID%ACTIONLOGID% and renamed %USERSTABLE%%ASPNETUSERSTABLE% in the replacement mappings; minor using/whitespace encoding adjustments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'RE1-T46 Fixing bug with action logs query' directly describes the main change: fixing a bug in action logs query by updating table placeholder references from '%USERSTABLE%' to '%ASPNETUSERSTABLE%' across four related query files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectPerviousActionLogsByUserQuery.cs`:
- Around line 30-33: Three ActionLogs query builders still reference the old
placeholder "%USERSTABLE%"; update their token arrays to use
"%ASPNETUSERSTABLE%" so the SQL templates in
SqlServerConfiguration/PostgreSqlConfiguration will be correctly replaced.
Locate the files SelectActionLogsByUserIdQuery.cs,
SelectLastActionLogByUserIdQuery.cs, and SelectActionLogsByCallIdQuery.cs and
modify the token list (the new string[] { ... } or similar token replacement
array inside each query builder) to replace "%USERSTABLE%" with
"%ASPNETUSERSTABLE%"; verify the other token names (e.g., "%ACTIONLOGSTABLE%")
remain unchanged. Ensure the change is applied in the same pattern as
SelectPerviousActionLogsByUserQuery.cs so generated SQL contains no unreplaced
tokens.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e2458f0f-5e60-4498-aa95-43985467c77a

📥 Commits

Reviewing files that changed from the base of the PR and between cce3c4f and 7675eaa.

📒 Files selected for processing (1)
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectPerviousActionLogsByUserQuery.cs

Comment on lines 30 to 33
new string[] {
"%ACTIONLOGSTABLE%",
"%USERSTABLE%"
"%ASPNETUSERSTABLE%"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n-- ActionLogs query classes using USER table placeholders --\n'
rg -n -C2 --glob '*.cs' '%(USERSTABLE|ASPNETUSERSTABLE)%' \
  Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs

printf '\n-- Definitions/usages of the previous-action-logs SQL template and placeholders --\n'
rg -n -C3 'SelectPreviousActionLogsByUserQuery|%(USERSTABLE|ASPNETUSERSTABLE)%' \
  Repositories/Resgrid.Repositories.DataRepository

Repository: Resgrid/Core

Length of output: 50368


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check which query builders use %USERSTABLE% and find their SQL template names
printf '\nActionLogs query builders still using %%USERSTABLE%%:\n'
rg -n '%(USERSTABLE)%' --glob '*.cs' \
  Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs | \
  grep -oE '[A-Za-z]+Query\.cs' | sort -u

printf '\n\nNow checking the SQL templates for these specific queries:\n'
# Check if SelectActionLogsByUserIdQuery has a corresponding SQL template
rg -A2 'SelectActionLogsByUserIdQuery' \
  Repositories/Resgrid.Repositories.DataRepository/Servers/SqlServer/SqlServerConfiguration.cs | head -5

Repository: Resgrid/Core

Length of output: 418


Update the three remaining ActionLogs query builders to use %ASPNETUSERSTABLE% instead of %USERSTABLE%.

The placeholder rename is incomplete. While SelectPerviousActionLogsByUserQuery.cs now uses %ASPNETUSERSTABLE%, three other ActionLogs query builders still reference %USERSTABLE%:

  • SelectActionLogsByUserIdQuery.cs
  • SelectLastActionLogByUserIdQuery.cs
  • SelectActionLogsByCallIdQuery.cs

The SQL templates in SqlServerConfiguration and PostgreSqlConfiguration use only %ASPNETUSERSTABLE%, so these three queries will generate SQL with unreplaced tokens. Update them in the same PR to complete the migration.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectPerviousActionLogsByUserQuery.cs`
around lines 30 - 33, Three ActionLogs query builders still reference the old
placeholder "%USERSTABLE%"; update their token arrays to use
"%ASPNETUSERSTABLE%" so the SQL templates in
SqlServerConfiguration/PostgreSqlConfiguration will be correctly replaced.
Locate the files SelectActionLogsByUserIdQuery.cs,
SelectLastActionLogByUserIdQuery.cs, and SelectActionLogsByCallIdQuery.cs and
modify the token list (the new string[] { ... } or similar token replacement
array inside each query builder) to replace "%USERSTABLE%" with
"%ASPNETUSERSTABLE%"; verify the other token names (e.g., "%ACTIONLOGSTABLE%")
remain unchanged. Ensure the change is applied in the same pattern as
SelectPerviousActionLogsByUserQuery.cs so generated SQL contains no unreplaced
tokens.

@ucswift
Copy link
Member Author

ucswift commented Mar 11, 2026

Approve

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This PR is approved.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectActionLogsByUserIdQuery.cs`:
- Line 1: The file SelectActionLogsByUserIdQuery.cs contains a duplicate UTF-8
BOM/zero-width no-break space before the using directive (the `using
Resgrid.Model;` line) which prevents compilation; open the file in a text editor
that can show invisible characters, remove the extra U+FEFF character so only a
single BOM (or none) remains, save the file with UTF-8 encoding (no BOM or a
single BOM), and verify the `using Resgrid.Model;` line begins with a normal
ASCII character.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 726a28b8-4769-44d0-943e-8cf536f46567

📥 Commits

Reviewing files that changed from the base of the PR and between 7675eaa and 740e602.

📒 Files selected for processing (3)
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectActionLogsByCallIdQuery.cs
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectActionLogsByUserIdQuery.cs
  • Repositories/Resgrid.Repositories.DataRepository/Queries/ActionLogs/SelectLastActionLogByUserIdQuery.cs

@ucswift
Copy link
Member Author

ucswift commented Mar 11, 2026

Approve

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This PR is approved.

@ucswift ucswift merged commit 3e41cf5 into master Mar 11, 2026
19 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Mar 11, 2026
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.

1 participant