-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
Dashboard! #3788
Merged
Dashboard! #3788
Changes from 173 commits
Commits
Show all changes
175 commits
Select commit
Hold shift + click to select a range
e7f43d3
Create dashboard/card partial
Benabik 64a5d6e
Also convert summary card to partial
Benabik e815d25
Github Workflows: Run rspec on all pull requests
Benabik 30279cb
Merge pull request #3780 from rubyforgood/card-partial
awwaiid cd08a7b
Issue #3736 - move purchases to new area
rae-stanton a7e46c6
Revert "Issue #3736 - move purchases to new area"
rae-stanton 3052d09
Add an "Outstanding Requests" card to org dashboard
Benabik c302248
Limit Outstanding Requests to 25
Benabik dd0265f
Restore remove button to dashboard cards
Benabik 5c77138
Merge pull request #3785 from rubyforgood/3669-outstanding-requests
awwaiid 7a4b9d0
Merge pull request #3787 from rubyforgood/card-remove-button
awwaiid 73deb2f
Initial Itemized Donations report extract from dashboard [#3733]
awwaiid 251f09c
Bring in date filter from other branch [#3733]
awwaiid 59a5cfb
Align text better [#3733]
awwaiid 914881a
Slight alignment cleanup [#3733]
awwaiid d4e67fa
refactor(dashboard): Move Distributions by County functionality [#372…
leesharma 802505c
Add a basic spec for the itemized donations report [#3733]
awwaiid 54e9f13
All the build on all the branches [#3733]
awwaiid be3f641
Add message when there are no items [#3733]
awwaiid 8bba60e
Merge remote-tracking branch 'origin/dashboard' into dashboard-itemiz…
awwaiid d85cce4
Satiate Rubocop! [#3733]
awwaiid 0a5b57d
Don't github action ci on both PR and Push [#3733]
awwaiid 357df3a
Remove itemized donations partial [#3733]
awwaiid 94f12c0
Issue #3736 - move purchases to new area
rae-stanton b8df3a5
Fix nesting of HTML rows [#3733]
awwaiid 020b4bb
rm extra index card for purchases summary
rae-stanton 1ca53e7
rm card partial under purchases summary
rae-stanton 77fda90
Merge pull request #3792 from rubyforgood/3736-actual-move-purchase-f…
awwaiid fe27dbe
Merge remote-tracking branch 'origin/dashboard' into dashboard-itemiz…
awwaiid 27b0309
Clean out some minor lint [#3733]
awwaiid 72fa881
Merge pull request #3791 from rubyforgood/dashboard-itemized-donation…
awwaiid 1a34dd7
Move itemized distribution into a standalone report [#3731]
awwaiid 0dc6632
Merge pull request #3796 from rubyforgood/dashboard-itemized-distribu…
awwaiid 48d0ebb
add a partners approval table to the dashboard
5268b42
Merge pull request #3799 from rubyforgood/3743-partner-approval-cards
awwaiid 5ed4e7e
Distributions summary
rae-stanton c6b0625
Clean out some lint! [#3723]
awwaiid ab21419
Merge pull request #3802 from rubyforgood/3723-distributions-summary
awwaiid 60a0515
Extract all helper methods related to donations into a DonationsHelper.
ChaelCodes d3098fe
Migrate Donations Summary (All Sources) from the Dashboard to Reporting
ChaelCodes 39af23b
Fix active styling for Reporting & Auditing in the sidebar.
ChaelCodes 1dd2d53
Working System Spec
ChaelCodes d4e6ec2
Merge pull request #3795 from ChaelCodes/3732-donations-all-sources
awwaiid 79ddf74
Move activity graph to a standalone report [#3798]
awwaiid 2f75591
Satiate Rubocop! [#3798]
awwaiid a6e84ce
Switch back to more tedious active-menu setup [#3798]
awwaiid ae90f1a
Make quotes consistent [#3798]
awwaiid 4b0dc7a
Remove that that has been extracted into another report [#3798]
awwaiid 1010cdc
Add very basic request spec for activity graph report [#3798]
awwaiid b2df7b1
boiler plate added
lokisk1155 0834a0d
try thisg
lokisk1155 955d9b9
add top manufactuers
lokisk1155 41aac22
dates + new donation button
lokisk1155 3b42cf0
Remove Feature specs for sections that are no longer on the dashboard.
ChaelCodes f726ba9
Add new Bank-wide low inventory report to Dashboard
ChaelCodes ef0b294
Only return if inventory levels are lower than minimum or recommended.
ChaelCodes 9f2ac37
Setup system specs and setup sufficient inventory levels message
ChaelCodes f5bc55a
Highlight quantities below minumum in low inventory report
ChaelCodes 5a73788
Move from using a QueryObject to a class method.
ChaelCodes 7ec14dc
Add title tooltip to records below the minimum quantity.
ChaelCodes 304e2a3
Merge branch 'main' into dashboard
awwaiid 1bcc0ff
Merge branch 'dashboard' into dashboard-activity-card-3798
awwaiid 1d38d58
Merge branch 'dashboard' into lokisk1155-#3735
awwaiid 97369e3
Merge pull request #3840 from ChaelCodes/3788-delete-donations-specs
awwaiid 4ada1e5
Merge branch 'dashboard' into dashboard-activity-card-3798
awwaiid 19ebe3b
Merge branch 'dashboard' into 3742-low-inventory-report
awwaiid 13d164a
Merge pull request #3857 from ChaelCodes/3742-low-inventory-report
awwaiid 547d4ba
Merge branch 'dashboard' into dashboard-activity-card-3798
awwaiid 9e92a98
Fix unrelated lint isue [#3798]
awwaiid 17aa91c
Fix navigation items [#3798]
awwaiid b25e320
Re-organize reports list [#3798]
awwaiid 6b890b7
Merge pull request #3819 from lokisk1155/lokisk1155-#3735
awwaiid 7cc0763
Merge remote-tracking branch 'origin/dashboard' into dashboard-activi…
awwaiid 88a53cb
Merge pull request #3812 from rubyforgood/dashboard-activity-card-3798
awwaiid 756f294
Merge branch 'main' into dashboard
awwaiid 8220e00
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid 75cd62e
Extract product drives card to separate report [#3734]
awwaiid a6b4849
Clean out some lint [#3734]
awwaiid 517d0fb
Fix page helper for product drive report spec [#3734]
awwaiid afd8c64
Move helper method to the correct spec [#3734]
awwaiid c20401c
Copy page helper [#3734]
awwaiid 6e0b771
Copy helper from dashboard page [#3734]
awwaiid 872f4ea
Merge branch 'main' into dashboard
awwaiid 96f245b
Merge branch 'dashboard' into 3734-move-product-drives-card-to-produc…
awwaiid 0919c22
Click on correct header [#3734]
awwaiid 90389b2
Remove clicking off of date range, it isn't needed [#3734]
awwaiid dbff0af
Rename to include summary [#3734]
awwaiid a216b66
Update tests to have Summary in the name [#3734]
awwaiid 444aa49
Revert accidental path change [#3734]
awwaiid e3a5e71
Merge pull request #3984 from rubyforgood/3734-move-product-drives-ca…
awwaiid 9c738a2
Add filter to mfg donation report and tune style [#3735]
awwaiid 0868441
Merge pull request #4028 from rubyforgood/manufacture-donations-filte…
awwaiid 831d4b0
Add basic request specs for some reports [#4029]
awwaiid e8e546c
Merge pull request #4030 from rubyforgood/dashboard-specs-4029
awwaiid 36c0704
Remove date-filter, other unused queries, and obey Bullet [#3724]
awwaiid b272b91
Filter on counties report directly [#3724]
awwaiid e2d1c22
Merge pull request #4032 from rubyforgood/remove-dashboard-filter-3724
awwaiid f44e444
Merge branch 'main' into dashboard
awwaiid c8b5131
Merge branch 'main' into dashboard
awwaiid bab467f
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid df0d759
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid 55d36e4
Clean out erb lint
awwaiid a6371f7
Fix expectations to work with cuprite
awwaiid b5dcff0
Wait for submenu to show before clicking through
awwaiid 128ff44
Clean out some rubocop lint
awwaiid f40cbce
Move donations summary into main reports controller
awwaiid cacb59a
Consolidate manufacturer donations into main reports controller
awwaiid a6428bf
Consolidate product drives summary into main reports controller
awwaiid e5341eb
Consolidate itemized donations report
awwaiid 2db7d1d
Consolidate itemized distributions report
awwaiid 407f738
Consolidate activity graph report
awwaiid 33ce9e4
Merge pull request #4095 from rubyforgood/dashboard-reports-controller
awwaiid 81b1247
Remove generic count/buttons and extract getting-started
awwaiid 8e89364
No longer displaying the totals
awwaiid 80fc8ff
Fix flaky test by waiting for javascript result
awwaiid ecdd904
Re-organize reports menu entries
awwaiid 8e4eb71
We no longer show the org logo on the dashboard
awwaiid 49821c9
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid e483637
Unify on request spec
awwaiid 4c5bbeb
Remove unnecessary forced spaces
awwaiid db4d441
Move an assertion from system to request spec
awwaiid 993778a
Clean out the lint trap
awwaiid f8ca6e0
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid 31bf22a
Move distributions summary into consolidated reports
awwaiid cefe205
Allow sub-controller paths for menu entries
awwaiid 922ec32
Consolidate purchases summary report with the other reports
awwaiid bce1288
Fix sidebar highlighting for reports and organization admin
awwaiid 2826843
Clean out some lint
awwaiid d7757c5
Consolidate summary reports specs
awwaiid ffef79b
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid 1f9c68b
Remove uneeded forced indent
awwaiid f3647c4
Validate the filters work
awwaiid 971697a
Assume active-class is always an array
awwaiid 0ebe7cf
Move donation spec from system to request style, fix lint
awwaiid 258005d
Migrate itemized donation report from system to request spec
awwaiid 123e8ca
Move system specs to request specs for product drive summary report
awwaiid c2638fe
Move purchase summary report spec from system to requests
awwaiid 2de9bcb
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid 6fd2f10
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid 7287c11
Merge branch 'main' into dashboard
awwaiid df48642
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid 7c5f900
Remove test from incorrect merge
awwaiid 5802818
Merge branch 'main' into dashboard
awwaiid 982f322
Port forward the organization_name param
awwaiid fc3ea3a
Fix new reports to use organization_name param
awwaiid 44b3978
Fix dashboard system spec to use application_name
awwaiid 4919505
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid d888831
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid 3049b6c
Merge branch 'main' into dashboard
awwaiid f4202a9
Only show outstanding requests for the current org
awwaiid b4c1cbd
Group low-inventory report by item, not storage location
awwaiid debb351
Show the expected email address for outstanding-request partners
awwaiid 3b274a7
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid ec47ef6
Update dashboard system spec with item-grouped low-inventory
awwaiid 8354477
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid 0b3cbc0
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid aba16d1
Run ci/cd checks on merges consistently
awwaiid b63d998
Pull :setup_date_range_picker call into before_action
awwaiid fadfd71
Match menu entries better
awwaiid 6273aa3
Clean up outstanding requests partial extraction
awwaiid 94c0ebd
Stringify action_name, esp when it is nil
awwaiid 5bf83f8
Extract partials for other dashboard blocks
awwaiid 9ab87d7
Update specs with new sidebar menu layout
awwaiid 5026b95
Merge branch 'main' into dashboard
awwaiid 72b1904
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid 312d881
Alphabetize sub-menu-entries
awwaiid 4ce6300
Add event-driven low inventory query
awwaiid f49a357
Update when github flows get executed
awwaiid b698b05
Update low inventory spec to work with events
awwaiid 2392f4f
Switch from direct-creating inventoryItems to creating a purchase
awwaiid a52a7d0
Use controller/action name instead of path for active menus
awwaiid 189dc89
Use Inventory::View to simplify low-inventory query
awwaiid a43b405
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid befd4fe
Fix up spec to match behavior
awwaiid d27aa81
Merge remote-tracking branch 'origin/main' into dashboard
awwaiid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
class ReportsController < ApplicationController | ||
before_action :setup_date_range_picker | ||
|
||
def donations_summary | ||
@donations = current_organization.donations.during(helpers.selected_range) | ||
@recent_donations = @donations.recent | ||
end | ||
|
||
def manufacturer_donations_summary | ||
@recent_donations_from_manufacturers = current_organization.donations.during(helpers.selected_range).by_source(:manufacturer) | ||
@top_manufacturers = current_organization.manufacturers.by_donation_count | ||
@donations = current_organization.donations.during(helpers.selected_range) | ||
@recent_donations = @donations.recent | ||
end | ||
|
||
def purchases_summary | ||
@purchases = current_organization.purchases.during(helpers.selected_range) | ||
@recent_purchases = @purchases.recent.includes(:vendor) | ||
end | ||
|
||
def product_drives_summary | ||
@donations = current_organization.donations.during(helpers.selected_range) | ||
@recent_donations = @donations.recent | ||
end | ||
|
||
def itemized_donations | ||
@donations = current_organization.donations.during(helpers.selected_range) | ||
@itemized_donation_data = DonationItemizedBreakdownService.new(organization: current_organization, donation_ids: @donations.pluck(:id)).fetch | ||
end | ||
|
||
def itemized_distributions | ||
distributions = current_organization.distributions.includes(:partner).during(helpers.selected_range) | ||
@itemized_distribution_data = DistributionItemizedBreakdownService.new(organization: current_organization, distribution_ids: distributions.pluck(:id)).fetch | ||
end | ||
|
||
def distributions_summary | ||
distributions = current_organization.distributions.includes(:partner).during(helpers.selected_range) | ||
@recent_distributions = distributions.recent | ||
end | ||
|
||
def activity_graph | ||
@distribution_data = received_distributed_data(helpers.selected_range) | ||
end | ||
|
||
private | ||
|
||
def total_purchased_unformatted(range = selected_range) | ||
LineItem.active.where(itemizable: current_organization.purchases.during(range)).sum(:quantity) | ||
end | ||
|
||
def total_distributed_unformatted(range = selected_range) | ||
LineItem.active.where(itemizable: current_organization.distributions.during(range)).sum(:quantity) | ||
end | ||
|
||
def total_received_donations_unformatted(range = selected_range) | ||
LineItem.active.where(itemizable: current_organization.donations.during(range)).sum(:quantity) | ||
end | ||
|
||
def received_distributed_data(range = selected_range) | ||
{ | ||
"Received donations" => total_received_donations_unformatted(range), | ||
"Purchased" => total_purchased_unformatted(range), | ||
"Distributed" => total_distributed_unformatted(range) | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Encapsulates business logic related to displaying Donations | ||
module DonationsHelper | ||
def total_received_donations(range = selected_range) | ||
number_with_delimiter total_received_donations_unformatted(range) | ||
end | ||
|
||
def total_received_money_donations(range = selected_range) | ||
current_organization.donations.during(range).sum { |d| d.money_raised || 0 } | ||
end | ||
|
||
def total_received_money_donations_from_product_drives(range: selected_range) | ||
current_organization.donations.by_source(:product_drive).during(range).sum { |d| d.money_raised || 0 } | ||
end | ||
|
||
def total_received_from_product_drives(range = selected_range) | ||
number_with_delimiter total_received_from_product_drives_unformatted(range) | ||
end | ||
|
||
private | ||
|
||
def total_received_donations_unformatted(range = selected_range) | ||
LineItem.active.where(itemizable: current_organization.donations.during(range)).sum(:quantity) | ||
end | ||
|
||
def total_received_from_product_drives_unformatted(range = selected_range) | ||
LineItem.active.where(itemizable: current_organization.donations.by_source(:product_drive).during(range)).sum(:quantity) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
class LowInventoryQuery | ||
def self.call(organization) | ||
if Event.read_events?(organization) | ||
inventory = View::Inventory.new(organization.id) | ||
items = inventory.all_items | ||
|
||
low_inventory_items = [] | ||
items.each do |item| | ||
quantity = inventory.quantity_for(item_id: item.id) | ||
if quantity < item.on_hand_minimum_quantity.to_i || quantity < item.on_hand_recommended_quantity.to_i | ||
low_inventory_items.push(OpenStruct.new( | ||
id: item.id, | ||
name: item.name, | ||
on_hand_minimum_quantity: item.on_hand_minimum_quantity, | ||
on_hand_recommended_quantity: item.on_hand_recommended_quantity, | ||
total_quantity: quantity | ||
)) | ||
end | ||
end | ||
|
||
low_inventory_items.sort_by { |item| item[:name] } | ||
|
||
else | ||
sql_query = <<-SQL | ||
SELECT | ||
items.id, | ||
items.name, | ||
items.on_hand_minimum_quantity, | ||
items.on_hand_recommended_quantity, | ||
sum(inventory_items.quantity) as total_quantity | ||
FROM inventory_items | ||
JOIN items ON items.id = inventory_items.item_id | ||
JOIN storage_locations ON storage_locations.id = inventory_items.storage_location_id | ||
WHERE storage_locations.organization_id = ? | ||
GROUP BY items.id, items.name, items.on_hand_minimum_quantity, items.on_hand_recommended_quantity | ||
HAVING sum(inventory_items.quantity) < items.on_hand_minimum_quantity | ||
OR sum(inventory_items.quantity) < items.on_hand_recommended_quantity | ||
ORDER BY items.name | ||
SQL | ||
|
||
sanitized_sql = ActiveRecord::Base.send(:sanitize_sql_array, [sql_query, organization.id]) | ||
ActiveRecord::Base.connection.execute(sanitized_sql).to_a | ||
end | ||
end | ||
end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the ones like it run brakeman and linting and such on all pushes/branches, not only
main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be reverted before merge, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep them -- they then will run the checks on any sub-branch PR which is what I expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All righty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized - removing
pull_request
means that it'll run on the branch but not on the merge commit. If the main branch has been updated, these runs will miss those commits.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK -- I tried to make it run on PR and consistently across all the jobs. Also updated the plantuml gen a bit. Here is the result -- aba16d1