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

I4 Most Sold Item for Merchant #35

Open
s-espinosa opened this issue Aug 3, 2017 · 0 comments
Open

I4 Most Sold Item for Merchant #35

s-espinosa opened this issue Aug 3, 2017 · 0 comments

Comments

@s-espinosa
Copy link

Summary

Iteration 4 #most_sold_item_for_merchant returns the most sold item spec does not match a common sense understanding of what that method would return.

Additional Detail

The Iteration 4 spec includes the following interaction pattern under the description which item sold most in terms of quantity and revenue:

sa = SalesAnalyst.new

sa.most_sold_item_for_merchant(merchant_id)
#=> [item] (in terms of quantity sold) 
# or, if there is a tie, [item, item, item]

sa.best_item_for_merchant(merchant_id)
#=> item (in terms of revenue generated)

With regards to quantity, this implies that for a Merchant that sold four forks in a single invoice and seven spoons across seven invoices, the method would return the spoon. However, for this method to work, students have had to find the InvoiceItem with the highest quantity for a particular merchant (and return the fork). There only seems to cause a discrepancy in the spec on line 105 of the iteration_4_spec document (assume that the earlier examples using the merchants on line 90 and 97 are not impacted by the two different ways of making this calculation).

Recommendation

Appears that this part of the spec harness is looking to see that ties are calculated correctly. Believe that means that we will need to find another Merchant who has items tied for their best selling item based on count.

Also believe that the #best_item_for_merchant method is calculated the same way. Fewer students have indicated an issue, likely because they use the pattern they found for #most_sold when they implement `#best_item.

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

No branches or pull requests

1 participant