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

BAE BAE BAE #59

Open
wants to merge 390 commits into
base: master
Choose a base branch
from
Open

BAE BAE BAE #59

wants to merge 390 commits into from

Conversation

laurenelee
Copy link

@laurenelee laurenelee commented Oct 27, 2017

bEtsy

Congratulations! You're submitting your assignment! These comprehension questions should be answered by all members of your team, not by a single teammate.

Comprehension Questions

Question Answer
How did your team break up the work to be done? Every morning we had a standup where we reviewed what we did the night prior and set goals for the day. Our communication was constantly streamlined because we always physically worked together. We had a retro at the end of the day (30 minutes prior to the day’s end) to choose tasks for the evening and check in on emotions. We did have set roles as the task manager and stand up leader and used them when necessary, but we also felt comfortable advocating for what tasks we wanted to take on next throughout the project.
How did your team utilize git to collaborate? We each worked on our branches. Sometimes we forgot. We pull-requested quite often. We never had any major merge conflicts. We were constantly aware of what doc each of us was modifying in an effort to avoid such conflicts.
What did your group do to try to keep your code DRY while many people collaborated on it? On the second to last day, Anders implemented a view helper for dates and price, which helped. Bennett streamlined the save and flash method and the total price method. We did a bunch of retroactive refactoring. We tried our best to discuss and share what methods we were creating beforehand so that we were aware when independently coding what models methods we could predict existing later on.
What was a technical challenge that you faced as a group? As a group, we were challenged by testing. It felt because it was such a fast timeline to production, and feeling nervous about letting our teammates down that sometimes we neglected design and TDD that we know is equally important. It was an interesting balance to try and navigate.
What was a team/personal challenge that you faced as a group? The three of us are friends. That was equally awesome and difficult at points. When one person was struggling, we were perhaps more invested emotionally than if we weren’t wearing multiple hats as friend and colleague. The good outweighed the bad however in that our support for one another was rooted in a place of genuine caring and ultimately allowed for the experience to be collaborative and fun.
What could your team have done better? We could have been better with TDD. We did too much of our testing retroactively. We could have asked for more help when we were stuck in the weeds. We also should have come up with a CSS style design before we each tried to implement unique visions.
What was your application's ERD? (include a link) For ERD: see concept board on Trello
What is your Trello URL? Trello link: https://trello.com/b/Gr4Pfwmi/tricycle
What is the Heroku URL of your deployed application? Heroku link: https://baebaebae.herokuapp.com/

anderschenders and others added 30 commits October 22, 2017 09:30
…ogged in merchant and not logged in users. Still need to write 2 tests here - for #create. Currently when you select no rating, getting a id cannot be for nil class error
…stance of OrderProduct. Add #increase_inventory method to Product model, to put inventory back in stock
…d if one with the same product_id already exists
… change if adding the same product to an order. This is currently failing.
…uctsController

Anders playing with order products controller
laurenelee and others added 27 commits October 26, 2017 17:41
Fixed a bug on receipt page, and wrote a missing test for OrdersController#receipt. 91% coverage
Fix little bug on order show page
@droberts-sea
Copy link

bEtsy

What We're Looking For

Feature Feedback
Baseline
Appropriate Git Usage with all members contributing yes
Answered comprehension questions yes
Trello board is created and utilized in project management yes
Heroku instance is online yes
General
Nested routes follow RESTful conventions yes
oAuth used for User authentication yes
Functionality restricted based on user roles yes
Products can be added and removed from cart yes
Users can view past orders no (or at least I could not figure out how, seems to be by design)
Merchants can add, edit and view their products yes
Errors are reported to the user yes
Order Functionality
Reduces products' inventory yes
Cannot order products that are out of stock yes
Changes order state yes
Clears current cart yes
Database
ERD includes all necessary tables and relationships yes
Table relationships yes
Models
Validation rules for Models yes
Business logic is in the models yes - great work
Controllers
Controller Filters used to DRY up controller code yes
Testing
Model Testing mostly - missing some, see inline
Controller Testing good start, missing a few test cases around authorization (see inline comments)
Session Testing yes
SimpleCov at 90% for controller and model tests yes
Front-end
The app is styled to create an attractive user interface yes - one nitpick: the white text of the header is difficult to read on top of the light green background
The app layout uses Foundation's Grid yes
Content is organized with HTML5 semantic tags yes
CSS is DRY yes
Overall Great job overall! This site is attractive, well-organized and easy to navigate, and as far as I could tell everything works. Test coverage is mostly solid, and I was not able to get away with any malicious behavior. As with any large project there are a few places where things could be cleaned up, and I've tried to point those out inline, but in general this is a very strong submission. You've clearly put in a ton of effort on the project, and it's paid off. Keep up the hard work!

IMPORTANT: Whoever submitted the PR (and thus will get the notification about this feedback) should share this with their teammates.

@@ -0,0 +1,40 @@
class CategoriesController < ApplicationController
before_action :must_be_logged_in, only: [:new, :create]

Choose a reason for hiding this comment

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

In general, when working with a controller filter that restricts user actions like require_login, best practice is to apply it to every action via the ApplicationController, and then mark exceptions one by one. This prevents you from forgetting one and leaving a hole in your site's security.

def show(status: nil)
@paid_orders = @merchant.sort_orders_by_status("paid")
@complete_orders = @merchant.sort_orders_by_status("complete")
if params[:status] == "paid" || params[:status] == nil

Choose a reason for hiding this comment

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

I'm curious about the argument to this method. It looks like status is never read, and as far as I'm aware Rails will never pass arguments to your controller actions.

has_many :products, through: :order_products
has_one :payment_info

scope :not_retired, -> { where(retired: false) }

Choose a reason for hiding this comment

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

Good use of a scope here.


self.order_products.each do |op|
if op.status != "complete"
incomplete += 1

Choose a reason for hiding this comment

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

Instead of using a counter, you could immediately return false here, and change the last line to return true. That would short-circuit the check as soon as an incomplete order is found.

You could also reduce this whole method to

return order_products.where.not(status: "complete").empty?

end

describe "update_status" do
it "if entire order is complete, sets flash[:status] to success when order is saved with specific message, redirects merchant show page, and sets the orderproduct status and orders status to complete" do

Choose a reason for hiding this comment

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

What if the logged in merchant is not the seller of that product? What if no one is logged in?

end
end

#Do we need tests for #create and #update here?

Choose a reason for hiding this comment

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

Yes. I also think there's a set of interesting cases you're missing around trying to edit, update or destroy a product when logged in a someone other that the seller.

end

#TODO: what if there are no orderproducts?
# it "sets flash[:status] to failure is there are no orderproducts" do

Choose a reason for hiding this comment

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

I was about to leave a comment with the same text as this TODO. This case is interesting.


#TODO:
describe "increase_inventory" do

Choose a reason for hiding this comment

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

Booooooo


describe "decrease_inventory" do
let(:tricycle) { products(:tricycle) }
it "decreases the inventory by the given quantity" do

Choose a reason for hiding this comment

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

What if you try to decrease the inventory by 0, or a negative number? What if you try to decrease it past the number in stock?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants