@@ -105,6 +105,16 @@ function qa_db_points_calculations()
'formula'=>"COUNT(*) AS adownvotes FROM ^uservotes AS userid_src JOIN ^posts ON userid_src.postid=^posts.postid WHERE userid_src.userid~ AND LEFT(^posts.type, 1)='A' AND userid_src.vote<0",
),
'cupvotes'=>array(
'multiple'=>0,
'formula'=>"COUNT(*) AS cupvotes FROM ^uservotes AS userid_src JOIN ^posts ON userid_src.postid=^posts.postid WHERE userid_src.userid~ AND LEFT(^posts.type, 1)='C' AND userid_src.vote>0",
),
'cdownvotes'=>array(
'multiple'=>0,
'formula'=>"COUNT(*) AS cdownvotes FROM ^uservotes AS userid_src JOIN ^posts ON userid_src.postid=^posts.postid WHERE userid_src.userid~ AND LEFT(^posts.type, 1)='C' AND userid_src.vote<0",
),
'qvoteds'=>array(
'multiple'=>$options['points_multiple'],
'formula'=>"COALESCE(SUM(".
...
...
@@ -123,6 +133,15 @@ function qa_db_points_calculations()
"), 0) AS avoteds FROM ^posts AS userid_src WHERE LEFT(type, 1)='A' AND userid~",
'UPDATE ^userpoints SET '.$zeropoints.' WHERE userid>=# AND userid<=#',// zero out the rest
$firstuserid,$lastuserid
);
if(QA_FINAL_EXTERNAL_USERS)
if(QA_FINAL_EXTERNAL_USERS){
qa_db_query_sub(
'INSERT IGNORE INTO ^userpoints (userid) SELECT DISTINCT userid FROM ^posts WHERE userid>=# AND userid<=# UNION SELECT DISTINCT userid FROM ^uservotes WHERE userid>=# AND userid<=#',
$firstuserid,$lastuserid,$firstuserid,$lastuserid
);
else
}else{
qa_db_query_sub(
'INSERT IGNORE INTO ^userpoints (userid) SELECT DISTINCT userid FROM ^users WHERE userid>=# AND userid<=#',