User's possibilities on site
Posted
by
Lari13
on Stack Overflow
See other posts from Stack Overflow
or by Lari13
Published on 2011-01-09T12:14:38Z
Indexed on
2011/01/09
12:53 UTC
Read the original article
Hit count: 145
I want to build a system on the website, that allows users to do some things depend on their rating. For example I have rule for rating value X:
- 1 post in 3 days
- 10 comments in 1 day
- 20 votes in 2 days
for rating value Y, rule may be following:
- 3 post in 1 day
- 50 comments in 1 day
- 30 votes in 1 day
Each night I recalculate users' ratings, so I know what each user is able to do. Possibilities don't sum or reset on each rating's recalculation.
One more important thing is that admin can fill concrete user's possibilities at any time.
What is optimal database (MySQL) structure for desired?
I can count what concrete user has done:
SELECT COUNT(*) FROM posts WHERE UserID=XXX AND DateOfPost >= 'YYY'
SELECT COUNT(*) FROM comments WHERE UserID=XXX AND CommentOfPost >= 'YYY'
But how can I do admin filling possibilities in this case?
© Stack Overflow or respective owner