<?php 


namespace Apps\Reward\Helper;


class RewardHelper {

    public static function GetStatusByUser($core, $userId){

        $request = "Select sum(r.Points) as nbPoint 
                    from RewardUser as ru
                    join RewardReward as r on r.Id = ru.RewardId        

        
        where ru.status = 2 and ru.UserId=" . $userId;

        $result = $core->Db->GetLine($request);

        return $result["nbPoint"] ? $result["nbPoint"] :  0 ;
    }
}