Skip to content

VPR-218 fix(phone): add dept code to SVMUnit EF - #362

Merged
bniedzie merged 1 commit into
mainfrom
fix/VPR-218-update-phone-tables-for-affiliates-view
Oct 8, 2026
Merged

bniedzie merged 1 commit into
mainfrom
fix/VPR-218-update-phone-tables-for-affiliates-view

Conversation

@bniedzie

@bniedzie bniedzie commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

This PR updates the EF for SVMUnit to include a new column needed for joining the new tables into vw_CurrentAffiliatesForPF. The new column is not used in the Personnel section at this time. The change in the view itself is documented in Viper 1.0.

Schema Change

This requires a schema change to be executed before deploying the code. This adds the DeptCode column for lookup and populates it from the legacy data.

ALTER TABLE phones.SVMUnit ADD DeptCode varchar(6) NULL;

WITH legacy AS (
    SELECT ROW_NUMBER() OVER (ORDER BY dvtUnit_sectionID, dvtUnit_unitID) AS NewUnitId,
           dvtUnit_sectionID, dvtUnit_unitName, dvtUnit_deptCode
    FROM PhoneLists.dbo.dvtUnit
    WHERE dvtUnit_unitID IS NOT NULL
)
-- Run as a SELECT first: every row should have NameMatch = 1
UPDATE u SET u.DeptCode = l.dvtUnit_deptCode
FROM VIPER.phones.SVMUnit u
JOIN legacy l ON l.NewUnitId = u.UnitId
             AND l.dvtUnit_sectionID = u.SectionId
             AND l.dvtUnit_unitName = u.Name;

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: ucdavis/VIPER/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 8082dced-2874-4717-8170-92ae59e160aa
📥 Commits

Reviewing files that changed from the base of the PR and between 3873b09 and 7d53c01.

📒 Files selected for processing (2)
  • web/Areas/Personnel/Models/SVMUnit.cs
  • web/Areas/Personnel/PhonesDbContext.cs

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

SVMUnit now has a nullable DeptCode property. Its database column mapping sets a maximum length of six characters and disables Unicode storage.

Changes

SVMUnit department code

Layer / File(s) Summary
Department code property and mapping
web/Areas/Personnel/Models/SVMUnit.cs, web/Areas/Personnel/PhonesDbContext.cs
Adds nullable DeptCode to SVMUnit. Maps the column with a maximum length of six characters and non-Unicode storage.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 7d53c

This adds an optional DeptCode mapping. The reviewed evidence establishes no concrete application failure or actionable merge blocker.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required format, includes the JIRA key, and describes adding the department code to SVMUnit.
Description check ✅ Passed The description explains the SVMUnit EF change and the required schema update.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
🧰 Additional context used
📚 Code guidelines (1)
.github/copilot-instructions.md — configured

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

@codecov-commenter

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov-commenter

codecov-commenter commented Oct 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.70%. Comparing base (3873b09) to head (7d53c01).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #362   +/-   ##
=======================================
  Coverage   45.70%   45.70%           
=======================================
  Files         954      954           
  Lines       49809    49810    +1     
  Branches     6750     6750           
=======================================
+ Hits        22765    22766    +1     
  Misses      26071    26071           
  Partials      973      973           
Flag Coverage Δ
backend 42.67% <100.00%> (+<0.01%) ⬆️
frontend 65.15% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
web/Areas/Personnel/Models/SVMUnit.cs 100.00% <ø> (ø)
web/Areas/Personnel/PhonesDbContext.cs 100.00% <100.00%> (ø)

@bniedzie
bniedzie requested a review from bsedwards October 6, 2026 15:06
@bniedzie
bniedzie merged commit ed7e779 into main Oct 8, 2026
13 of 14 checks passed
@bniedzie
bniedzie deleted the fix/VPR-218-update-phone-tables-for-affiliates-view branch October 8, 2026 20:51
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.

3 participants