Let the statisticsForms model return the total signups instead of the form model

- added unit test for getTotalSignups() method
This commit is contained in:
Jonathan Labreuille
2016-07-19 17:38:45 +02:00
parent 515515ba9f
commit 362ee49ce4
4 changed files with 22 additions and 8 deletions

View File

@ -6,6 +6,10 @@ if(!defined('ABSPATH')) exit;
class StatisticsForms extends Model {
public static $_table = MP_STATISTICS_FORMS_TABLE;
public static function getTotalSignups($form_id = false) {
return self::where('form_id', $form_id)->count();
}
public static function record($form_id, $subscriber_id) {
if($form_id > 0 && $subscriber_id > 0) {
// check if we already have a record for today