5aab6ccc155bafa99b51188a5446d38b6df705b1 jcasper Tue Apr 1 13:57:52 2014 -0700 Replaced MyQQL 'like' comparison of dates with an alternative that doesn't cause warnings diff --git src/utils/qa/sessionStats.csh src/utils/qa/sessionStats.csh index 76d77d6..0a47fd5 100755 --- src/utils/qa/sessionStats.csh +++ src/utils/qa/sessionStats.csh @@ -32,47 +32,47 @@ exit else if ( $argv[1] != "go" ) then if ( $argv[1] == "short" ) then set short=$argv[1] else echo echo ' only "go" are "short" are permitted as arguments' $0 exit endif endif endif # get months sessions has been alive: -set months=`hgsql -N -h $sqlrr -e "SELECT DISTINCT firstUse FROM namedSessionDb" hgcentral \ - | awk -F- '{print $1"-"$2}' | sort -u` +set months=`hgsql -N -h $sqlrr -e 'SELECT DISTINCT DATE_FORMAT(firstUse, \ + "%Y-%m") FROM namedSessionDb' hgcentral | sort -u` # get stats rm -f tempOutFile echo echo " first count users shared reused " echo "------ ----- ----- ------- -------" foreach month ( $months ) set count=`hgsql -N -h $sqlrr -e 'SELECT COUNT(*) FROM namedSessionDb \ - WHERE firstUse LIKE "'$month%'"' hgcentral` + WHERE DATE_FORMAT(firstUse, "%Y-%m") = "'$month'"' hgcentral` set users=`hgsql -N -h $sqlrr -e 'SELECT COUNT(DISTINCT(userName)) \ - FROM namedSessionDb WHERE firstUse like "'$month%'"' hgcentral` + FROM namedSessionDb WHERE DATE_FORMAT(firstUse, "%Y-%m") = "'$month'"' hgcentral` set shared=`hgsql -N -h $sqlrr -e 'SELECT COUNT(*) FROM namedSessionDb \ - WHERE firstUse LIKE "'$month%'" AND shared = 1' hgcentral` + WHERE DATE_FORMAT(firstUse, "%Y-%m") = "'$month'" AND shared = 1' hgcentral` set reuse=`hgsql -N -h $sqlrr -e 'SELECT firstUse, lastUse FROM namedSessionDb \ - WHERE firstUse LIKE "'$month%'"' hgcentral \ + WHERE DATE_FORMAT(firstUse, "%Y-%m") = "'$month'"' hgcentral \ | awk '$1 != $3 {print $1, $3}' | wc -l` echo $month $count $users $shared $reuse \ | awk '{printf ("%7s %4s %5s %4s %2d%% %4s %2d%%\n", \ $1, $2, $3, $4, $4/$2*100, $5, $5/$2*100)}' | tee -a tempOutFile # increment totals set countTot=`echo $countTot $count | awk '{print $1+$2}'` set userTot=`echo $userTot $users | awk '{print $1+$2}'` set shareTot=`echo $shareTot $shared | awk '{print $1+$2}'` set reuseTot=`echo $reuseTot $reuse | awk '{print $1+$2}'` end echo "------- ----- ----- ------- -------" echo "total " $countTot $userTot $shareTot $reuseTot \ | awk '{printf ("%7s %4s %5s %4s %2d%% %4s %2d%%\n", \