Skip to content

Conversation

@dcollie2
Copy link
Collaborator

Reopening PR #430 which was accidentally merged prematurely.

Original PR

Summary

This PR enables the ability to transmit multiple CSV files specific to each provider.

Changes

  • Modified FileUploadJob to accept language or provider parameters
  • Incorporated 5 CSV files into the provider file set for transmission
  • Implemented looping through provider files in the content processor
  • Updated associated tests for both the job and processor components

Files Changed

  • 15 files changed: 167 insertions(+), 105 deletions(-)

Copy link

@johnpaulashenfelter johnpaulashenfelter left a comment

Choose a reason for hiding this comment

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

Could of minor comments.

What would be most useful?

private

attr_reader :language, :processor, :share
attr_reader :language, :file_id, :share, :processor

Choose a reason for hiding this comment

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

Nitpick: 🔤 would make the diff a little easier.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please explain what would make the diff easier? And what to you mean by "diff" here?

attr_reader :language, :processor, :share
attr_reader :language, :file_id, :share, :processor

def send_provider_content(provider_id)

Choose a reason for hiding this comment

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

Consider keyword so you throw an error if provider_id is not defined?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why throwing an error?

files: FileToUpload.new(
content: ->(provider) { CsvGenerator::Files.new(provider).perform },
name: ->(provider) { "#{language.file_storage_prefix}#{provider.name.parameterize}-file.csv" },
path: "#{language.file_storage_prefix}CMES-v2/assets/csv",

Choose a reason for hiding this comment

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

Consider hoisting these up to the top since they are the same in all the methods? On less magic value (the path) stuffed into that interpolation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please explain what do you mean by "hoisting these up to the top"? Extracting some parts of the code?

end

def perform(language_id, content_id, content_type, share = ENV["AZURE_STORAGE_SHARE_NAME"])
def perform(language_id, file_id, provider_id = nil, share = ENV["AZURE_STORAGE_SHARE_NAME"])

Choose a reason for hiding this comment

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

Just curious -- why the env var in the signature? That gets serialized into the runner and then when its hydrated its already evaluated so old/failed jobs would write to the enque-time value, not the current value

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is only default value and not the signature itself, right? Or do I miss something?

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.

Provider-specific CSV Files

4 participants