Point system class and db
Posted: Sun Nov 04, 2012 5:58 pm
I'm designgin a point system for my app. Basically whenever an "action" takes place I'd like to call the class that adds points to their db.
such as $achievement->completed_task('task_name')
and have points added based off task_name.
So two questions, how would you suggest handling this in the db? increase a row per action completed with the number of points they received then for their score add all the rows? That way actions/points can be tracked/logged?
For the class i was thinking it might go something like this.. Thouhts?
Thoughts?
Thanks,
such as $achievement->completed_task('task_name')
and have points added based off task_name.
So two questions, how would you suggest handling this in the db? increase a row per action completed with the number of points they received then for their score add all the rows? That way actions/points can be tracked/logged?
For the class i was thinking it might go something like this.. Thouhts?
Code: Select all
class Achievements {
public function completed_task($task) {
case($task)
scored:
+15pts
break;
quit:
-10pts
break;
}
}
Thanks,