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

batch: tabulate on build/create calls #388

Merged
merged 1 commit into from
Dec 5, 2018

Conversation

adamdecaf
Copy link
Member

This change gets rid of the requirements to provide a batchControl and/or fileControl objects in the JSON for an ach.File object.

Part of: https://github.com/moov-io/moov-io/pull/12

@@ -422,15 +430,15 @@ func TestFile__readFromJson(t *testing.T) {
}
batch := file.Batches[0]
batchControl := batch.GetControl()
if batchControl.EntryAddendaCount != 2 {
if batchControl.EntryAddendaCount != 1 {
Copy link
Member Author

Choose a reason for hiding this comment

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

@bkmoovio Shouldn't this be 0? The ppd-valid.json file has no addenda records.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure why, but Batch.build calls entryCount++ (which is now 1 + entry.addendaCount()). That doesn't seem right?

Copy link
Contributor

@bkmoovio bkmoovio Dec 4, 2018

Choose a reason for hiding this comment

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

Hi Adam,

EntryAddendaCount in the Company/Batch Control Record and File Control Record can be confusing as it is not the AddendaCount for an Entry. It is (for reference page OR108) the tally for each Entry Detail Record processed and each Addenda Record processed, within either the batch or file, as appropriate. For a BatchPPD with one EntryDetail , and no Addenda05, EntryAddendaCount should be 1, If the one EntryDetail has an Addenda05, EntryAddendaCount would be 2. Hopefully that helps . (Clear as Mud)

For the second question:

Prior to removing addendumer change, the code set entryCount as follows:

for i, entry := range batch.Entries {
entryCount = entryCount + 1 + len(entry.Addendum)....

going forward I had added +1 to entryCount for each entry (EntryDetail) + each Addenda property if the property was defined. Addenda02, len(Addenda05), Addenda98, Addenda99. it looks like you created a function for that which is great. I should have.

Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding ++,

golang/go#21263

To funny... :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, okay. Those names are confusing but it makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

well that's a good idea.

@codecov-io
Copy link

codecov-io commented Dec 4, 2018

Codecov Report

Merging #388 into master will decrease coverage by 0.63%.
The diff coverage is 64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #388      +/-   ##
==========================================
- Coverage   85.41%   84.78%   -0.64%     
==========================================
  Files         107      107              
  Lines        6774     8813    +2039     
==========================================
+ Hits         5786     7472    +1686     
- Misses        712     1059     +347     
- Partials      276      282       +6
Impacted Files Coverage Δ
reader.go 80.19% <ø> (-2.78%) ⬇️
batcher.go 100% <ø> (ø) ⬆️
entryDetail.go 94.35% <100%> (+0.11%) ⬆️
file.go 74.28% <14.28%> (-2.9%) ⬇️
batch.go 93.42% <71.42%> (-1.03%) ⬇️
test/ach-adv-read/main.go 55.55% <0%> (-8.09%) ⬇️
test/ach-axt-read/main.go 57.14% <0%> (-8.08%) ⬇️
test/ach-ccd-read/main.go 57.14% <0%> (-8.08%) ⬇️
test/ach-iat-read/main.go 60% <0%> (-8%) ⬇️
test/ach-trc-read/main.go 47.82% <0%> (-7.73%) ⬇️
... and 98 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e47e36...b347d08. Read the comment docs.

@bkmoovio bkmoovio requested a review from wadearnold December 5, 2018 00:01
@@ -177,7 +179,7 @@ func (f *File) setBatchesFromJSON(bs []byte) error {
if err := json.Unmarshal(bs, &batches); err != nil {
return err
}
// Clear out any nil batchs
// Clear out any nil batchess
Copy link
Contributor

Choose a reason for hiding this comment

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

batches

@adamdecaf adamdecaf merged commit b347d08 into moov-io:master Dec 5, 2018
@adamdecaf adamdecaf deleted the no-control-blobs branch December 5, 2018 01:49
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.

4 participants