Assignment 5: New feature for the “publications” app

October 31st, 2009 Leave a comment Go to comments

Both assignments 4 and 5 are due 23-Nov.; automatic extension to 25-Nov. If you complete assignment 4 early, submit it, and we’ll see if we can get comments back to you early.

The publications application is useful, but there is no way to tell what people really like.

Your assignment is to implement some means to gauge the popularity or value of a publication. You must also write up how you decided on your strategy, and how you implemented it.

You must modify the application to

  1. Accept ratings, votes, or “likes” for individual publications (more on these terms below), or figure out some other way to determine popularity (for example, count clicks on links).
  2. Show a count or average of the ratings, votes, or “likes” on each publication.
  3. Sort the publications by your metric.

Now, in deciding how to determine popularity or value, you’re going to have to put on your design / usability / product features hat. We want your evaluation of popularity/value to stand up. Here are some considerations:

  1. Voting means that you can vote “up” or “down.” Most likely, a user or visitor should only get one vote. I would think that a user or visitor should be able to change his or her vote (perhaps the user made a mistake, or changed his or her mind).
  2. Another way to think about it is a rating from 0 to 5 stars. Again, users should be able to change their ratings.
  3. A “like” (as used on Facebook) it like voting, but there’s no negative vote. I don’t think you can “unlike” something on Facebook, but you would probably want to provide that if you go this route.
  4. To express an assessment of a publication, must the user be logged in? If not, you open the ratings system up to abuse, and it would be harder for a user to change a vote after leaving the site, and coming back. You’ll have to decide.
  5. Another way to do this is to track clicks. The way this works is you point the Amazon and Safari links to an action which writes a row into a clicks table. The clicks table would need to have a foreign key pointing to the publication; and you’d want to know whether the link was an Amazon or Safari link. After the click has been recorded, then you redirect the user to the place he or she originally wanted to go. Again, there is the question as to whether a click should be counted multiple times per user, or only once.

Do not worry about visual appearance! For voting, you can provide ordinary text links or buttons that say “Vote Up” or “Vote Down.” Similarly, for a rating, you can have links to text for “1″ “2″ “3″ “4″ and “5.” In other words, assume that for a real feature a designer would help you out.

Nice-to-haves . . . While there is no extra credit, the very best submissions may . . .

  1. Implement the voting / rating / like system with Ajax;
  2. OR, provide an administrative controller that provides a more analytic view of the collected data.
  1. Keith
    November 21st, 2009 at 01:44 | #1

    @Lateral Punk
    Are you using fixtures?

    You don't want to try and put anything in your test database. Rails and the testing framework build the database for you and handle the setup / teardown of test data.

  2. November 21st, 2009 at 19:44 | #2

    My tests were failing for each controller unit test. I just commented out the lines where it says:

    test "the truth" do
    assert true
    end
    

    I came back to read over this and see if there whas something I was missing with needing to write unit tests. After I removed those lines though, it did work..

  3. Ron Newman
    November 21st, 2009 at 20:09 | #3

    I'm curious -- how would a test like that fail?

  4. November 21st, 2009 at 22:32 | #4

    @Ron Newman

    About the only thing I can think of is that a controller or model is missing, but the test still exists, and the framework is causing problems because of that.

  5. November 22nd, 2009 at 02:33 | #5

    @Ron Newman

    @john
    I dove into this a little more. When I created the model for ratings, I used script/generate... It apparently created a file named ratings.yml, and in this file there were four lines, which I had to comment out. This fixed any issues that I was having.

    The four lines were very familiar to what I saw in different yml files:

    # one:
    #   value:
    #
    # two:
    #   value:
    
  6. Karin Berger
    November 23rd, 2009 at 09:06 | #6

    Hi,

    Where should the writeup for assignment 5 be located?

    Thanks,
    Karin

  7. November 23rd, 2009 at 09:14 | #7

    @Karin Berger

    You may put it in the top-level README, or a file called student-writeup.txt

    In order of format preference: .txt, .pdf, .rtf, .doc (please, no .docx).

  8. Ron Newman
    November 23rd, 2009 at 09:21 | #8

    My directory already has a (short) student-writeup.txt for Assignment 4, so I'll rename that one to student-writeup-4.txt .

  9. Ron Newman
    November 24th, 2009 at 11:18 | #9

    I'm finding this in my server log every so often. It doesn't seem to be in response to any particular action I'm taking on the web site. Is some daemon running automatically and failing?

    Processing UsersController#index to atom (for ::1 at 2009-11-24 11:16:56) [GET]
    
    ActionController::UnknownAction (No action responded to index. Actions: current_user and logged_in?):
      <internal:prelude>:8:in `synchronize'
      /Users/ronnewman/.ruby_versions/ruby-1.9.1-p243/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
      /Users/ronnewman/.ruby_versions/ruby-1.9.1-p243/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
      /Users/ronnewman/.ruby_versions/ruby-1.9.1-p243/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
    
    Rendering rescues/layout (not_found)
    
  10. November 24th, 2009 at 11:25 | #10

    @Ron Newman

    Not that I know of. Um . . . Are you using Clearance?

  11. Ron Newman
    November 24th, 2009 at 12:55 | #11

    Nope, no Clearance in my Assignment 5.

  12. November 24th, 2009 at 13:04 | #12

    @Ron Newman

    I won't be able to look at it for at least 24 hours, but if you like, ZIP your project and e-mail it to me.

  13. Ken Busch
    November 24th, 2009 at 13:28 | #13

    @Ron Newman Why would assert true fail?

    This is actually an example from the book's unit test chapter where it does fail. Short answer: configuration.

  14. Ron Newman
    November 24th, 2009 at 20:14 | #14

    @John: OK, I just zipped up my project (which isn't quite done yet, as I still have to finish the student writeup) and e-mailed it to you. I can't correlate any action that I'm taking in the browser to these error messages in the log. No error is ever sent to the browser.

Comment pages
1 2 569
  1. No trackbacks yet.