简体   繁体   English

我应该如何为我的Android应用程序构建/设计评级系统?

[英]How should I build/design a ratings system for my Android application?

I am building a mobile Android application where users are able to find the nearest locations around them and then when viewing these places, they are allowed to see the details and also rate it. 我正在构建一个移动Android应用程序,用户可以在其中找到附近的位置,然后在查看这些位置时允许他们查看详细信息并对其进行评分。 On top of this, they are allowed to add new places onto the map. 最重要的是,他们被允许在地图上添加新地点。 I want to be able to lower the chance of people adding fake spots the best I can and so this is why I want to implement a ratings system, which is another layer security for fake spots. 我希望能够尽可能减少人们添加假景点的机会,因此这就是为什么我要实施评级系统的原因,这是假景点的另一层安全措施。

I am not sure how I should design my database tables. 我不确定如何设计数据库表。 Right now I only have: 现在我只有:

Location: name, address, type, terrain, difficulty, lng, lat, rating.

The ratings column is only allowed values: 1, 2, 3, 4, 5. 评级列仅允许使用以下值:1、2、3、4、5。

What else would I need to keep the sum of the ratings? 我还需要什么来保持评分的总和?

After designing the tables. 设计表格后。 I want to know the most appropriate way to calculate the average ratings and then be able to delete them based on their ratings. 我想知道最合适的方法来计算平均收视率,然后能够根据其收视率将其删除。 The problem is, if a spot has 1 vote with a rating of 1 which is 100% negative then it will be considered bad when aa spot has a vote of 100 with 90 votes with 1 and 10 votes with 5. Surely, the first one should be considered worse and then deleted. 问题是,如果一个点具有1票且评级为1,即100%否定票,则当一个点具有100票,90票和1票,以及10票和5票时,它将被认为是不好的。应该被认为更糟,然后删除。 How do I counter this? 我该如何应对?

There's lots of ways of doing this. 有很多方法可以做到这一点。 More complex trend-monitoring systems buffer votes and look at the rate over the last day, hour, minute etc. 更复杂的趋势监控系统缓冲选票,并查看最后一天,小时,分钟等的汇率。

However, for a simple system, you could look at total number of votes and average rating. 但是,对于简单的系统,您可以查看总投票数和平均评分。 You may not care about the sum (and you can get it anyway from the other two). 您可能不在乎总和(而且您可以从其他两个总和中获得总和)。

To update the rating: 更新评分:

average = ((average*total)+new)/(sum+1);
total ++;

When you look at deleting them you'll want to set a threshold for a minimum number of votes (total) and then delete based on average rating. 当您考虑删除它们时,您将需要为最低投票数(总计)设置一个阈值,然后根据平均评分删除。 1 bad vote probably isn't really enough, how many you think is, depends on your usage levels. 1次不良投票可能还不够,您认为多少取决于您的使用水平。

For other answers: PHP/MySQL - algorithm for "Top Rated" 对于其他答案: PHP / MySQL-“最高评分”算法

I would say making a separate table containing foreign keys of the id of the location and id of the user submitting the review would be useful(as well as there rating of course). 我想说一个单独的表,其中包含位置ID和提交评论的用户ID的外键将很有用(当然还有评分)。 This way users could edit their review at a later time. 这样,用户可以在以后编辑其评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM