You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rave.apache.org by Ankur Goyal <as...@umail.iu.edu> on 2011/11/22 23:20:39 UTC

Rave-359: Few questions

Hi,

While I was fixing this ticket Rave-359, I noticed two things:

1> In the js file rave_store.js the two functions which are called on the
click of likeRadioButton and dislikeRadioButton seem to be doing the same
functionality with the variables reversed.
    Can this be put into one function which will have two parameters (the
id's of the two radio buttons) and called through those two functions by
passing their ids as parameters?

2> While updating the new rating values for the widget on the call of the
above two functions, there was no update done for the userRating property
in the WidgetStatistics.java file.
     So just wondering if this will in any way effect the working of the
code? (According to me, it should not create a problem but just want to
know).


Regards,
Ankur Goyal

RE: Rave-359: Few questions

Posted by "Cooper, Sean D." <se...@mitre.org>.
>-----Original Message-----
>From: Ankur Goyal [mailto:asgoyal@umail.iu.edu]
>Sent: Tuesday, November 22, 2011 5:21 PM
>To: rave-dev@incubator.apache.org
>Subject: Rave-359: Few questions
>
>Hi,
>
>While I was fixing this ticket Rave-359, I noticed two things:
>
>1> In the js file rave_store.js the two functions which are called on the
>click of likeRadioButton and dislikeRadioButton seem to be doing the same
>functionality with the variables reversed.
>    Can this be put into one function which will have two parameters (the
>id's of the two radio buttons) and called through those two functions by
>passing their ids as parameters?
>

Yes, this could be done.  I made it two separate functions to aide in the readablilty of the method calls.  It was a toss-up between readability and code re-use so I went for the readability. 

>2> While updating the new rating values for the widget on the call of the
>above two functions, there was no update done for the userRating property
>in the WidgetStatistics.java file.
>     So just wondering if this will in any way effect the working of the
>code? (According to me, it should not create a problem but just want to
>know).
>

The bug allows the user to increase the like/dislike button value by 2 votes rather than just a single vote.  When this happens there are two updates to the REST back-end setting the user's vote to the appropriate value.  Since these are duplicate setters you won't see the totals go up by two on the WidgetStatistics object but instead it should increase by one.  The WidgetStatistics object is generated from the database when the page reloads, there is no explicit update called on the WidgetStatistics object.

>
>Regards,
>Ankur Goyal