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

#3067: add required info on csv partner export (partial solution) #4229

Merged

Conversation

callmarx
Copy link
Contributor

@callmarx callmarx commented Mar 26, 2024

Partial #3067

Description

This is a partial solution for the issue that includes only the following into the partner agencies export:

  • Agency address (line 1 and line 2)
  • Agency city
  • Agency state
  • Agency zip code
  • website
  • Agency type

As this is my first PR and contact with the project, I intend to make another one to include the information "providing diapers" and "providing period supplies" when I got a better overview of it.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Successful passed on rspec test, which I included into the partner model test, and check it manually the download based on seeds data

Screenshots

unnecessary

@callmarx callmarx changed the title [WIP] #3067: add required info on csv partner export (partial solution) #3067: add required info on csv partner export (partial solution) Mar 26, 2024
@cielf
Copy link
Collaborator

cielf commented Mar 27, 2024

Background for whoever is reviewing (probably @dorner) -- @callmarx is new to open source but experienced in Ruby - I suggested doing a partial on this as a Good First Issue since we are out of those and Difficulty-Beginner at the moment.

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

Looks pretty good! I've got a couple of minor functionality quibbles.

I'm also thinking that we should add the "other agency type" to the agency type column if the agency type is other. I can make that a separate issue in the spirit of avoiding scope creep -- but if you want to make the adjustment that would also be ok. What do you think?

app/models/partner.rb Show resolved Hide resolved
spec/models/partner_spec.rb Show resolved Hide resolved
@@ -172,6 +172,12 @@ def self.csv_export_headers
[
"Agency Name",
"Agency Email",
"Agency address",
"Agency City",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor quibble: inconsistent capitalization -- please caplitalize address.

primary_contact_phone: contact_phone
primary_contact_phone: contact_phone,
address1: agency_address,
city: agency_city,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would do a test with both address1 and address 2.

@callmarx
Copy link
Contributor Author

Hi @cielf, I fixed the minor functionality quibbles and implemented a solution to include other_agency_type info when agency_type is Partner::AGENCY_TYPES["OTHER"]

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

Functionality LGTM. @dorner Could you take a quick look to see if there's anything you don't like from a code style pov?

@cielf cielf requested a review from dorner March 27, 2024 21:29
Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

More minor quibbles. 😄 Otherwise looks good!

return {} if profile.blank?

@agency_info = {
address: [profile.address1, profile.address2].reject(&:blank?).join(', '),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I usually prefer positive over negative statements, so I'd like this to be .select(&:present?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's definitely make the code more readable. Thanks

expect(partner.csv_export_attributes).to include(agency_state)
expect(partner.csv_export_attributes).to include(agency_zipcode)
expect(partner.csv_export_attributes).to include(agency_website)
expect(partner.csv_export_attributes).to include("#{Partner::AGENCY_TYPES["OTHER"]}: #{other_agency_type}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't the order of columns important? We should be checking the exact array that's returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! I've changed the test for the exact value of csv_export_attributes and the title to "should has the info in the columns order"

@dorner
Copy link
Collaborator

dorner commented Mar 28, 2024

@callmarx there's a failing test - can you fix it?

@cielf cielf merged commit 9ec64db into rubyforgood:main Jun 9, 2024
Copy link
Contributor

@callmarx: Your PR #3067: add required info on csv partner export (partial solution) is part of today's Human Essentials production release: 2024.06.16.
Thank you very much for your contribution!

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