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

Update item name feature to handle HEAR rebate projects #187

Merged
merged 4 commits into from
Sep 23, 2024

Conversation

veekas
Copy link
Contributor

@veekas veekas commented Sep 20, 2024

Description

This fixes an issue in which HEAR rebate cards weren't showing up when the technologies they applied to were considered to be in multiple project categories, i.e. Rhode Island's rebates being applicable to stoves and clothes dryers

Test Plan

Zip code: 02903; hhsize 1, income 30000

Screenshot 2024-09-20 at 3 59 30 PM
Screenshot 2024-09-20 at 3 59 43 PM

Copy link

vercel bot commented Sep 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
embed-rewiringamerica-org ✅ Ready (Inspect) Visit Preview Sep 20, 2024 8:27pm


test('HEAR rebates applicable to multiple appliances', () => {
expect(
itemName(['heat_pump_clothes_dryer', 'electric_stove'], msg, 'cooking'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should 'heat_pump_clothes_dryer' be included here?

Copy link
Member

@oyamauchi oyamauchi left a comment

Choose a reason for hiding this comment

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

This is fine as-is, but I think introducing project into this logic allows for a more general solution:

  1. At the top of itemName, compute the intersection of the Project's items and the items array.
  2. If the result is one item, use the existing single-item logic.
  3. If the result is multiple items (as it will be in all the preexisting cases), use the existing multipleItemsName.

That would handle this HEAR case cleanly, as well as others I could imagine like a HEAR incentive that includes non-heat-pump dryers, heat pump dryers, and stoves. (Non-HP + HP dryer is already handled in the multi-item logic, so you'd get that for free without having to duplicate it in hearName, for example.)

Approving in case you want to just roll with this for expediency, but I think the above is where we should end up eventually.

@oyamauchi
Copy link
Member

Going to merge this to fix the outstanding problem with RI; we can follow up with my suggestion later.

@oyamauchi oyamauchi merged commit fd8f44b into main Sep 23, 2024
3 checks passed
@oyamauchi oyamauchi deleted the veekas-hear-item-names branch September 23, 2024 18:28
oyamauchi added a commit that referenced this pull request Sep 23, 2024
## Description

This is what I was talking about in #187.

It ended up being more involved than I thought, because Jest couldn't
handle the JSX in the file `projects.tsx`. I tried other values of the
`jsx` setting in tsconfig.json, but then Jest couldn't handle the
magical `jsx:...` imports in projects.tsx (understandable; that's done
using Parcel magic).

So I factored out the icons from projects.tsx into a new file, and now
the unit test works fine.

## Test Plan

`yarn test`. The unit test is unmodified but still passes.

Look at RI's HEAR incentive for stoves/dryers, and make sure it shows
up and has the correct headline.
oyamauchi added a commit that referenced this pull request Sep 28, 2024
## Description

This is what I was talking about in #187.

It ended up being more involved than I thought, because Jest couldn't
handle the JSX in the file `projects.tsx`. I tried other values of the
`jsx` setting in tsconfig.json, but then Jest couldn't handle the
magical `jsx:...` imports in projects.tsx (understandable; that's done
using Parcel magic).

So I factored out the icons from projects.tsx into a new file, and now
the unit test works fine.

## Test Plan

`yarn test`. The unit test is unmodified but still passes.

Look at RI's HEAR incentive for stoves/dryers, and make sure it shows
up and has the correct headline.

Make sure the icons in the projects dropdown are correct. The one in
the dropdown button should be purple, and in the menu should be
grey-700 (i.e. almost black).
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