[OSU-242] Public estimates - #6458
Open
diebas wants to merge 4 commits into
Open
Conversation
diebas
marked this pull request as ready for review
September 7, 2026 13:39
joaquinco
reviewed
Sep 7, 2026
Comment on lines
+21
to
+27
| return [[t(".internal"), "internal"], [t(".external"), "external"]] if PriceGroup.secondary_external.blank? | ||
|
|
||
| [ | ||
| [t(".internal"), "internal"], | ||
| [t(".external_for_profit"), "external"], | ||
| [t(".external_non_profit"), "external_non_profit"], | ||
| ] |
Collaborator
There was a problem hiding this comment.
can we have this predefined to base and external and allow each school override it? what do you think?
Comment on lines
+43
to
+44
| @requested_quantities ||= | ||
| params[:quantities].presence&.to_unsafe_h&.select { |_id, quantity| quantity.to_i.positive? } || {} |
Collaborator
There was a problem hiding this comment.
let's use strong parameters instead of to_unsafe_h
| estimate = Estimate.new(facility: @facility, price_group: @price_group) | ||
|
|
||
| requested_quantities.each do |product_id, quantity| | ||
| product = @products.find_by(id: product_id) |
Collaborator
There was a problem hiding this comment.
is there a chance we can make a single db query?
joaquinco
approved these changes
Sep 8, 2026
Comment on lines
+125
to
+128
| base: Internal | ||
| external: External | ||
| external_2: External - non-profit | ||
| cancer_center: Cancer Center |
Collaborator
There was a problem hiding this comment.
let's make it consistent with the price groups we have defined for open (without external_2)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Notes
Visitors can now get a cost estimate without logging in. A "Get an Estimate" link next to Support opens a page where they pick whether they are internal or external, choose a facility, and enter quantities for the products they are interested in, then see the estimated cost. Off by default behind the
public_estimatesfeature flag.OSU-242 | Public estimates
Additional Context
Nothing is persisted. Phase 1 calculates and displays only.
PublicEstimatesController#showbuilds an in-memoryEstimatewithestimate_details.buildand callsassign_price_policy_and_coston each detail — no new models and no migration. That method was already able to run on unsaved records; the specs pin that it resolves the policy, computes the same cost as a persisted equivalent, and writes nothing.Price group selection.
PriceGroup.for_public_estimatemaps the visitor's answer to a global price group: internal →base, external non-profit →secondary_externalfalling back toexternal, everything else →external.PriceGroup.secondary_externalis new and returnsnilwhenprice_group.name.external_2is unset, so schools without a second external group only see two options instead of three.Cost does not depend on the user. Verified through
PricePolicySelectorand all threeestimate_cost_from_estimate_detailimplementations — they read only price group, quantity and duration, which is what makes an accountless estimate possible.Existing admin views were not reused.
facility_estimates/show.html.hamlcallsincludesandmaximumon the association, which hit the database and therefore return nothing for an unsaved estimate.Products are listed from
available_for_estimates, excluding bundles. A product with no purchaseable, in-date policy on the selected price group is shown as "No public rate available" rather than hidden, so visitors can tell the difference between a product that is unavailable and one that simply has no public rate.Screenshot
Screen.Recording.2026-09-07.at.10.29.30.AM.mov