Skip to content
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

[CPDNPQ-2210] Statement + contract setup #2116

Merged
merged 9 commits into from
Jan 21, 2025

Conversation

rwrrll
Copy link
Contributor

@rwrrll rwrrll commented Jan 13, 2025

Context

Ticket: https://dfedigital.atlassian.net/browse/CPDNPQ-2210

Ability to create statements (including contracts) for a cohort

@rwrrll rwrrll requested a review from a team as a code owner January 13, 2025 13:32
@rwrrll rwrrll marked this pull request as draft January 13, 2025 13:32
@rwrrll rwrrll force-pushed the 2210-contract-and-statement-setup branch from 58341fb to e87c050 Compare January 13, 2025 15:14
Copy link

@rwrrll rwrrll force-pushed the 2210-contract-and-statement-setup branch from c25de36 to 9e451dc Compare January 14, 2025 14:55
@rwrrll rwrrll marked this pull request as ready for review January 14, 2025 15:05
Copy link
Contributor

@jebw jebw left a comment

Choose a reason for hiding this comment

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

Looks great, I'd second @slawosz comment re: not reimplementing the SuperAdmin checks

Only point that's not a 'comment' is the schema change for default value on a statement seems wrong to me?

attr_accessor :error

def self.read(csv_file, row_class)
lines = CSV.read(csv_file, headers: true, encoding: "bom|utf-8") # encoding needed for some Excel CSVs
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL bom|utf-8

app/services/statements/bulk_creator/parser.rb Outdated Show resolved Hide resolved
spec/support/helpers/tempfile_helper.rb Show resolved Hide resolved
@@ -0,0 +1,5 @@
class SetStatementDefaultReconcileAmount < ActiveRecord::Migration[7.1]
def change
change_column_default :statements, :reconcile_amount, from: nil, to: 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty against this one - we shouldn't have a 'default amount' for a number we should be calculating - if its 0 then some code should have calculated its zero and set it?

nil shows nothing has calculated the amount

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to give the background here, it's not something the application ever calculates, it's a value that the finance team can optionally use to adjust the total of a statement (although the tool to actually set it doesn't exist (yet?))

It was added in 059377e "initial models for Statement and StatementItem" as part of separation, all existing statements had their reconcile_amount migrated over so the default was never a concern... however, now that we are creating new statements, this brings the column definition into parity with ECF, where it is:

t.decimal "reconcile_amount", default: "0.0", null: false

I can certainly see the argument in the other direction, but the reason I went with setting a default is that we will never set it automatically, and it won't necessarily be set/changed manually for every statement... Having said that we can certainly leave as nil if you prefer, if so I will modify the statement views to treat nil as 0, otherwise any statements we create (via this PR or otherwise) won't be viewable

@@ -0,0 +1,22 @@
class StrictDecimal < ActiveModel::Type::Integer
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this 🙌

@rwrrll rwrrll force-pushed the 2210-contract-and-statement-setup branch from 052cf8d to a27a268 Compare January 20, 2025 12:29
@rwrrll rwrrll requested a review from jebw January 20, 2025 12:38
Copy link
Contributor

@jebw jebw left a comment

Choose a reason for hiding this comment

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

LGTM 🙌

@rwrrll rwrrll added this pull request to the merge queue Jan 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 21, 2025
@rwrrll rwrrll added this pull request to the merge queue Jan 21, 2025
Merged via the queue into main with commit 7b09d6c Jan 21, 2025
17 of 18 checks passed
@rwrrll rwrrll deleted the 2210-contract-and-statement-setup branch January 21, 2025 16:31
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