-
Notifications
You must be signed in to change notification settings - Fork 47
Ports - Faiza #39
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
base: master
Are you sure you want to change the base?
Ports - Faiza #39
Conversation
…s to cofirm database seeded correctly from csv file
Users stuff
Added model tests
…cted spelling mistakes
Fixed view for works/index to show correct number or works for each c…
Media RankerWhat We're Looking For
Great work with this project, Faiza! Your code on this project looks fantastic, and definitely hits and demonstrates accomplishing the learning goals. Besides the small details I mentioned above (some missing flash messages/form error messages on certain things, a missing view), my other comments are on more small code style suggestions. They're minor and mostly there to help you think about refactoring. That being said; well done! This was a huge project with a lot of moving parts. ALSO your controller tests were great! I have no comments on how to improve them at the moment! :) |
| if work.category == category | ||
| works_sorted_by_category << work | ||
| end | ||
| end |
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.
Nice iteration! :)
| if work.category == category | ||
| works_sorted_by_category << work | ||
| end | ||
| end |
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.
Consider this refactor: using works_sorted_by_category = Work.where(category: category)
def self.sort_by_category(category)
works_sorted_by_category = []
works_sorted_by_category = Work.where(category: category)
return works_sorted_by_category
endYou'd have to update your test to not expect this to be an Array though
| return works_sorted_by_category | ||
| end | ||
|
|
||
| def self.popular(category: nil) |
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 is a super clever helper method! You pulled out repeated logic. Well done!
| end | ||
|
|
||
| def self.media_spotlight | ||
| return popular.first |
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 a note for consistency (not a big deal): Above in self.popular, you invoke the other class methods with Work.sort_by_category, but here you invoke the class method with just popular. It may make more sense to be consistent: Work.sort_by_category and Work.popular, or sort_by_category and popular (PS: In your tests you consistently do Work.popular etc)
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? What is the difference between them?