Space - Hala#43
Conversation
Media RankerFunctional Requirements: Manual Testing
Major Learning Goals/Code Review
Previous Rails learning, Building Complex Model Logic, DRYing up Rails Code
Testing Rails Apps
Overall Feedback
Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
|
beccaelenzil
left a comment
There was a problem hiding this comment.
Great work on this assignment. Your code is clear and well written, and it is clear that the learning goals were met. Your models are very well tested. I've let a few in-line comments focused on ways you could DRY up your code with partial views and controller filters. Please let me know if you have any questions. Keep up the hard work!
| </div> | ||
| </div> | ||
|
|
||
| <div class="row flex-nowrap"> |
There was a problem hiding this comment.
You essentially have the same code repeated three times. Consider how you could use a partial view or a loop to DRY up this code.
| </thead> | ||
| <tbody> | ||
| <h3> Top Albums </h3> | ||
| <% Work.albums_list.each do |work| %> |
There was a problem hiding this comment.
As above, you essentially have the same code repeated 3 times. Consider how you may dry up this code, including modifying your model method to take the category as an argument.
| return Work.all.max_by { |work| work.votes.count } | ||
| end | ||
|
|
||
| def self.movies_list |
There was a problem hiding this comment.
Consider how you could DRY up this code by using the category as an argument.
def self.sorted_list(category)
| end | ||
|
|
||
| def destroy | ||
| @work = Work.find_by(id: params[:id]) |
There was a problem hiding this comment.
Note that you need to find a work in multiple actions. This would be great functionality to put into a controller filter.
| expect(@spotlight_media).must_be_instance_of Work | ||
| expect(@works.max_by { |work| work.votes.count }).must_equal @spotlight_media | ||
| end | ||
|
|
There was a problem hiding this comment.
Consider including another test for what happens if two works are tied.
| end | ||
|
|
||
| describe "relationships" do | ||
| it "has relationships with Work and User" do |
There was a problem hiding this comment.
Consider breaking this into 2 tests since it is 2 different relationships.
Media Ranker
Congratulations! You're submitting your assignment!
Comprehension Questions
sessionandflash? What is the difference between them?Assignment Submission: Media Ranker
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection
sessionandflash? What is the difference between them?