Skip to content

Incorrect diaper drive numbers#1030

Merged
armahillo merged 11 commits intomasterfrom
972-incorrect-diaper-drive-numbers
Jun 11, 2019
Merged

Incorrect diaper drive numbers#1030
armahillo merged 11 commits intomasterfrom
972-incorrect-diaper-drive-numbers

Conversation

@armahillo
Copy link
Copy Markdown
Collaborator

This accomplishes 2 things:
Closes #972 - it addresses the bug that @pdxdiaperbank reported
Ref #1024 - it expands test coverage substantially for the Dashboard.

We didn't really have any good test coverage for when the user wanted to filter by the different parameters. there were a few tests, but nothing exhaustive. This adds some pretty robust tests for each of the conditions. It also renames a couple of the options to make it a bit more clear what the users can expect.

This PR also fixes a couple minor bugs in factories (line items were creating duplicate itemizables when they were built in factories -- whoops!).

I need to finish cleaning up the file still, but it's nearly done.

Copy link
Copy Markdown
Member

@mdworken mdworken left a comment

Choose a reason for hiding this comment

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

Looks awesome! It might be good to add tests re: active vs inactive line items if there aren't any yet.

Copy link
Copy Markdown
Member

@seanmarcia seanmarcia left a comment

Choose a reason for hiding this comment

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

👍


def selected_range
now = DateTime.now
now = Time.zone.now
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm surprised Rubocop didn't complain about this sooner.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

IKR?

Actually -- you know I bet it did, but that it's in the rubocop ratcheting ignore file that Brock made for us a while back

</div>
<div class="box-body text-center float-center">
<h3 class="text-center"><%= @recent_donations.by_source(:diaper_drive).count %> Diaper Drives <%= display_interval %> for a total of <%= number_with_delimiter(@recent_donations.by_source(:diaper_drive).sum { |d| d.line_items.total }) %> items collected</h3>
<h3 class="text-center"><%= @recent_donations.by_source(:diaper_drive).map(&:diaper_drive_participant).uniq.size %> Diaper Drives <%= display_interval %> for a total of <%= total_received_from_diaper_drives %> items collected</h3>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you want to call .uniq on this? If they had 20 diaper drives and 15 of those were at one location won't it show as 6 diaper drives in the period not 20?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think this is one of the areas that we need to revisit with Diaper Drives. The way we have it, it could be entered in a way that treats Diaper Drive Participants as either:

  • the diaper drive itself, assuming diaper drives are separate efforts (so all donations coming in from diaper drive X get associated with Diaper Drive Participant X)
  • an organization that contributes to a unnamed diaper drive (Diaper Drive Participants X, Y and Z all contribute to a general "diaper drive")

it's possible that I just don't have a correct understanding of how it works, too :) I think the UI should provide a little more guidance about the expectation of what the things mean

Oh -- I do agree that the language is incorrect, though -- it says "diaper drives" but really it's tracking "number of diaper drive participants" -- I'll fix that now so at least the language is consistent.

I don't know how to track how many individual diaper drives there are (assuming they can be separate things and are not just an ongoing effort).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

organization { Organization.try(:first) || create(:organization) }
issued_at { nil }
amount_spent_in_cents { 1000 }
amount_spent_in_cents { 10_00 }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cents.

…es Audit factory, begins expanding and improving Dashboard test coverage. Adds time zone specificity to datetime helpers in dashboard helper. Renames a couple of the date range names
…re it was counting the number of diaper drive donations as the number of participants, and the total was being limited to the recent total only.
…uage changes. Moves Date range filter down closer to the area where it actually affects. Cleans up the remaining specs that were lingering. There are a few examples marked pending because I'm not sure how to handle them. Will create an issue.
…s to need tightening. As did the changes to the Donation factory.
@armahillo armahillo force-pushed the 972-incorrect-diaper-drive-numbers branch from 23ecb75 to d18ec3b Compare June 11, 2019 01:50
@armahillo armahillo merged commit 4597e62 into master Jun 11, 2019
@armahillo armahillo deleted the 972-incorrect-diaper-drive-numbers branch June 11, 2019 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diaper Drive Widget on Dashboard Incorrect

3 participants