Ignore:
Timestamp:
04/16/19 21:25:08 (6 years ago)
Author:
Daniela Dorner
Message:
added do-update option to speed-up filling of new values for the current period
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Tools/fill_r750.sh

    r19495 r19496  
    44sqlpw=/home/$USER/.mysql.pw.op
    55dbname=factdata
    6 # fill only corrected R750
    7 #short="yes" # comment line to fill also reference values
     6
     7query="SELECT Max(fPeriod) FROM RunInfo WHERE NOT ISNULL(fR750Cor)"
     8pmaxcor=`mysql --defaults-file=$sqlpw -s -e "$query" `
     9echo "fR750Cor is already filled up to P"$pmaxcor
     10
     11query="SELECT Max(fPeriod) FROM RunInfo WHERE NOT ISNULL(fR750Ref)"
     12pmaxref=`mysql --defaults-file=$sqlpw -s -e "$query" `
     13echo "fR750Ref is already filled up to P"$pmaxref
     14
     15
    816
    917# setup for zd- and th-correction:
     
    1725query="UPDATE RunInfo SET "
    1826query=$query" fR750Cor=round(fNumThreshold750/("$min")/("$cor"),2) "
    19 query=$query" WHERE fRunTypeKey=1 AND NOT (("$min")/("$cor"))=0"
     27query=$query" WHERE fRunTypeKey=1 AND NOT (("$min")/("$cor"))=0 "
     28query=$query" AND fPeriod>="$pmaxcor
    2029echo $query
    2130mysql --defaults-file=$sqlpw -s -e "$query"
    22 
    23 # todo: replace this by trigger in DB (finalize correction formula for this)
    24 
    25 if [ "$short" == "yes" ]
    26 then
    27    echo ""
    28    echo "Exit (short=yes)"
    29    exit
    30 fi
    31 
    3231
    3332# reference values for corrected R750
     
    126125       240.0 #92 (current period)
    127126       )
     127if [ ${#rates[@]} -lt $pmaxref ]
     128then
     129   ${#rates[@]}" "$pmaxref
     130   exit
     131fi
     132
     133if [ "$doupdate" == "yes" ]
     134then
     135   numstart=0
     136else
     137   numstart=$pmaxref
     138fi
    128139
    129140# fill reference values
    130141echo ""
    131142echo "Filling the reference values for the corrected R750 for "${#rates[@]}" periods to the DB..."
    132 for (( i=0; i < ${#rates[@]} ; i++))
     143for (( i=$numstart; i < ${#rates[@]} ; i++))
    133144do
    134145   echo "Filling P"$i
     
    143154   mysql --defaults-file=$sqlpw -s -e "$query"
    144155done
     156
     157if [ $numstart -gt 0 ]
     158then
     159   exit
     160fi
    145161
    146162echo "Filling split periods..."
Note: See TracChangeset for help on using the changeset viewer.