如何使用jQuery星级评级插件与ASP。NET和SQL Server数据库。

时间:2022-11-24 13:12:31

I want to implement a rating system for my application to rate events.

我想为我的应用程序实现一个评级系统来对事件进行评级。

I've been searching and I think this is the list that I need to do to achieve the rating system and I'll also attach what I found about each point.

我一直在寻找,我认为这是我需要做的列表,以实现评级系统,我也将附上我发现的每一点。

  1. Find a JQuery plugin : JRating, Opineo, RateIt

    找到一个JQuery插件:JRating, Opineo, RateIt。

  2. Find a suitable algorithm: I've searched a lot but didn't find a good algorithm till now

    找到一个合适的算法:我搜索了很多,但是直到现在还没有找到一个好的算法

  3. Determine the database structure that I'm going to use

    确定我要使用的数据库结构

  4. The c# code and the JavaScript code required to implement the plugin and send the poll results to the database

    实现插件并将投票结果发送到数据库所需的c#代码和JavaScript代码

I think that's it! if you have any suggestions or points to add please share it.

我认为这是它!如果你有任何建议或要点,请分享。

1 个解决方案

#1


5  

I've built a rating system similar to yours, so I'll contribute some additional points to consider:

我已经建立了一个类似于你的评级系统,所以我将提供一些额外的观点来考虑:

  1. As to the rating plugin, I chose jQuery Star Rating, which worked just fine, but I suspect that any of the other mentioned plugins will be fine as well.
  2. 至于评级插件,我选择了jQuery Star rating,它运行得很好,但是我怀疑其他提到的插件也可以。
  3. As for an algorithm, I used a simple average of all the ratings for the composite rating of an item. I also made sure to display the count of ratings so people know how reliable the average is.
  4. 对于算法,我使用了一个简单的平均值来表示一个项目的复合评级。我还确保显示了收视率,这样人们就能知道平均值的可靠性。
  5. As to the database structure, it depends on whether you allow anonymous ratings or not. The application I built only allowed logged-in users to rate items, so I had a table that stored the user ID, the item ID and the rating. This helped prevent the same user from rating an item multiple times and kept all of the data around for me to generate my average. (If you allow anonymous ratings, then I suggest that you store the IP address or session identifier to dissuade people from rating more than once. You won't be able to stop it but you can discourage it.) You'll probably also want to compute aggregate ratings via a batch job, or at least cache the computation so it isn't redone every time an item is viewed.
  6. 至于数据库结构,这取决于是否允许匿名评级。我构建的应用程序只允许登录的用户对项目进行评级,所以我有一个存储用户ID、项目ID和评级的表。这有助于防止同一用户多次对某一项进行评级,并保留所有数据,以便生成平均值。(如果您允许匿名评级,那么我建议您存储IP地址或会话标识符,以阻止人们进行多次评级。你无法阻止它,但你可以阻止它。您可能还希望通过批处理作业计算聚合评级,或者至少缓存计算,以便不会在每次查看条目时重新执行计算。

There's plenty of coding to be done and plenty of issues to consider to implement a "simple" ratings system, so I hope these thoughts help.

要实现一个“简单”的评级系统,有很多代码要做,也有很多问题要考虑,所以我希望这些想法能有所帮助。

#1


5  

I've built a rating system similar to yours, so I'll contribute some additional points to consider:

我已经建立了一个类似于你的评级系统,所以我将提供一些额外的观点来考虑:

  1. As to the rating plugin, I chose jQuery Star Rating, which worked just fine, but I suspect that any of the other mentioned plugins will be fine as well.
  2. 至于评级插件,我选择了jQuery Star rating,它运行得很好,但是我怀疑其他提到的插件也可以。
  3. As for an algorithm, I used a simple average of all the ratings for the composite rating of an item. I also made sure to display the count of ratings so people know how reliable the average is.
  4. 对于算法,我使用了一个简单的平均值来表示一个项目的复合评级。我还确保显示了收视率,这样人们就能知道平均值的可靠性。
  5. As to the database structure, it depends on whether you allow anonymous ratings or not. The application I built only allowed logged-in users to rate items, so I had a table that stored the user ID, the item ID and the rating. This helped prevent the same user from rating an item multiple times and kept all of the data around for me to generate my average. (If you allow anonymous ratings, then I suggest that you store the IP address or session identifier to dissuade people from rating more than once. You won't be able to stop it but you can discourage it.) You'll probably also want to compute aggregate ratings via a batch job, or at least cache the computation so it isn't redone every time an item is viewed.
  6. 至于数据库结构,这取决于是否允许匿名评级。我构建的应用程序只允许登录的用户对项目进行评级,所以我有一个存储用户ID、项目ID和评级的表。这有助于防止同一用户多次对某一项进行评级,并保留所有数据,以便生成平均值。(如果您允许匿名评级,那么我建议您存储IP地址或会话标识符,以阻止人们进行多次评级。你无法阻止它,但你可以阻止它。您可能还希望通过批处理作业计算聚合评级,或者至少缓存计算,以便不会在每次查看条目时重新执行计算。

There's plenty of coding to be done and plenty of issues to consider to implement a "simple" ratings system, so I hope these thoughts help.

要实现一个“简单”的评级系统,有很多代码要做,也有很多问题要考虑,所以我希望这些想法能有所帮助。