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

DiscoveryReport templates #255

Merged
merged 3 commits into from
Sep 12, 2018
Merged

DiscoveryReport templates #255

merged 3 commits into from
Sep 12, 2018

Conversation

atz
Copy link
Contributor

@atz atz commented Sep 12, 2018

These are stub templates, but show structure and test it. I don't mind if reviewers prefer to wait for them to be further fleshed out, but they are mergeable as is. Since there is some confusion about how these components might work together, this may be clarifying.

Note: because of the Enumerator, we can use the form:

render partial: 'row', collection: @discovery_report.each_row

That knows to iterate over the Enumerator.

We can also imagine other template outputs (JSON, HTML, etc.) based on the same structure.

@atz atz added the review label Sep 12, 2018
@coveralls
Copy link

coveralls commented Sep 12, 2018

Pull Request Test Coverage Report for Build 800

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+2.2%) to 61.64%

Changes Missing Coverage Covered Lines Changed/Added Lines %
app/services/discovery_report.rb 0 1 0.0%
Totals Coverage Status
Change from base Build 789: 2.2%
Covered Lines: 609
Relevant Lines: 988

💛 - Coveralls

Copy link
Contributor

@ndushay ndushay left a comment

Choose a reason for hiding this comment

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

So as this stands, we have view code for the discovery report, but the view code isn't triggered by anything so it isn't actually rendered anywhere -- it's just to have a way to write tests?

and is the ultimate idea that we will have templates write to a file, and the discovery_report_job will tell discovery report to run, and that job or another will send an email with a url when the report is ready? (and the form submission response could also provide the same url, but the data isn't there yet)?

'cause if that what this is, I'd rather merge a PR that creates a file and tests what will be written to the file as these templates are sort of "test-y".

Might also be good to check with Ben if we want to produce a csv report or if there are any other "what the report should look like" things (I doubt it)

fields.join(' , ')
end

# For use by template
def skipped_files
files = ['Thumbs.db', '.DS_Store'] # if these files are in the bundle directory but not in the manifest, they will be ignorned and not reported as missing
files << File.basename(content_md_creation[:smpl_manifest]) if using_smpl_manifest?
files << File.basename(manifest) if using_manifest?
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we were requiring a manifest file in all cases -- so the if clause can go, but the line should stay?

Copy link
Contributor

Choose a reason for hiding this comment

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

^^ whoops - I guess the above is a "request changes"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, incorporated 2 lines earlier in the initial array.

@atz
Copy link
Contributor Author

atz commented Sep 12, 2018

Yes, I think your projection of the ultimate goal is correct. But to be clear, this PR is not going to get into:

  1. writing an output file
  2. testing an output file
  3. anything involving jobs
  4. including sending an email
  5. controller integration

So there is no payoff to holding out for those things here. The next step (that could be in PR or subsequent) would be making the partial template for row dynamic (i.e. not just an example line).

Copy link
Contributor

@ndushay ndushay left a comment

Choose a reason for hiding this comment

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

Aside from two more teeny actual concerns, up to you if you want me to merge this and let you do more complete templates separately.

fields.concat ['Num Files in CM Manifest', 'All CM files found'] if using_smpl_manifest?
fields.concat ['Duplicate Filenames?', 'DRUID', 'Registered?', 'APO exists?']
fields << 'SourceID unique in DOR?' if using_manifest?
fields.concat ['Duplicate Filenames?', 'DRUID', 'Registered?', 'APO exists?', 'SourceID unique in DOR?']
Copy link
Contributor

Choose a reason for hiding this comment

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

whoops - can get rid of "SourceID unique in DOR?" header -- sorry I didn't notice on first pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like we can get rid of headers completely, if we are making the report output JSON.

fields.join(' , ')
end

# For use by template
def skipped_files
files = ['Thumbs.db', '.DS_Store'] # if these files are in the bundle directory but not in the manifest, they will be ignorned and not reported as missing
files = ['Thumbs.db', '.DS_Store', manifest] # if these files are in the bundle directory but not in the manifest, they will be ignorned and not reported as missing
Copy link
Contributor

Choose a reason for hiding this comment

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

looks good. slight preference for manifest first (and I think :manifest might need to get a delegation in bundle.db? Also the comment reads a little weird now (and has a typo) -- maybe just change it to a method comment?

Also remove `header` method.  We won't be building pseudo-CSV w/
handcrafted header string anymore.
This is just to show how the object, template and partial fit together.

Note: because of the Enumerator, we can use the form:
```
render partial: 'row', collection: @discovery_report.each_row
```

That knows to iterate of the Enumerator.
@atz
Copy link
Contributor Author

atz commented Sep 12, 2018

I'm cool w/ merging this as is, since from our conversations, I gather that what we are really after is more structured JSON output (not plaintext).

@ndushay
Copy link
Contributor

ndushay commented Sep 12, 2018

merging. Assume you'll address the need to delegate :manifest in bundle.rb in another PR.

@ndushay ndushay merged commit 773daa1 into master Sep 12, 2018
@ndushay ndushay deleted the dr_templates branch September 12, 2018 22:05
@ndushay ndushay removed the review label Sep 12, 2018
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.

None yet

3 participants