# Last edited on 2019-07-17 15:38:44 by stolfilocal
# Grading the MC930/MC937/MO603 lab hand-ins (2014-1)

PROCESSING OF MC930/MC937/MO603 HAND-INS

  Processing must be done on Cratera since there is no POV-Ray on mamaus.

CREATING LOGS DIRECTORY

    mkdir LOGS JUNK
    
FETCHING STUDENT FILES FROM STANDARD LOCATIONS

  Fetched labs:

    fetch-labs.sh tp00 tp01 tp02
    fetch-labs.sh tp03 tp04
    fetch-labs.sh tp05 tp06 tp07 tp08
    fetch-labs.sh tp09 tp10 tp11 tp12 tp13
    fetch-labs.sh tp14
 
FETCHING STUDENT FILES FROM NON-STANDARD LOCATIONS

#  Fetched additional files:
#  
#    now="`yyyy-mm-dd-hhmmss`"
#    for trud in \
#      tp00.007989.ra007989.2017-03-22 
#    do
#      xx=( `echo ${trud} | tr '.' ' '` )
#      tp="${xx[0]}"
#      ra="${xx[1]}"
#      usr="${xx[2]}"
#      dt="${xx[3]}"
#      lablog="LOGS/fetch-labday-files-${tp}-${now}.log"
#      fetch-student-files.sh ${tp} ${ra} www.students.ic.unicamp.br ${usr} mc937/${dt}/ main.pov main.png
#      stulog="${tp}/${ra}/wget-log.txt"
#      if [[ -e ${stulog} ]]; then cat ${stulog} >> ${lablog}; fi
#    done
#  

LISTING ALL FETCHED FILES

  cat `ls LOGS/fetch-*.log` \
    | extract-fetched-files-from-log.gawk \
    | sort \
    > .all-fetched

LIST MISSING JOBS

  Listing all missing student/lab pairs:
  
    list-missing-labs.sh 

  Repeating 'LISTING ALL FETCHED FILES' and 'LIST MISSING JOBS'

CHECKING INCONSISTENT DATES

  Checking dates of fetched files:

    cat .all-fetched \
      | flag-inconsistent-dates.sed \
      | sed -e 's:/main: main:' \
      | sort -b -k3,3 -k4,4 -k2,2r \
      | egrep -v -e '[ ][+]' \
      > .inconsistent-dates.txt

  No inconsitencies in tp00, tp01, tp02.
  
  Inconsistencies in tp03:

    ~ra221525/mc937/2019-03-22 2019-03-22-190500 tp03 : OK, handed in at 19:05.
    ~ra148729/mc937/2019-03-22 2019-03-21-161600 tp03 : Exported old file without doing anything.

    ~ra136686/mc937/2019-04-12 2019-04-05-162700 tp06 : Exported old file without doing anything.

    ~ra139511/mc937/2019-04-26 2019-04-26-234400 tp07 : OK, handed in at 23:44.

    ~ra148729/mc937/2019-05-03 2019-05-03-195000 tp08 : OK, handed in at 19:50.
    
    ~ra139511/mc937/2019-05-10 2019-05-10-211300 tp09 : OK, handed in at 21:13
    
    ~ra145715/mc937/2019-05-17 2019-05-17-191400 tp10 : OK, handed in at 19:14
    
    ~ra139511/mc937/2019-05-24 2019-05-24-220200 tp11 : OK, handed in at 22:02
    
    ~ra139511/mc937/2019-06-07 2019-06-07-220300 tp13 : OK, handed in at 22:03

GRADING THE LABS

  Done:
  
    ( cd tp00 && ../display-and-grade-labday.sh )
    ( cd tp01 && ../display-and-grade-labday.sh )
    ( cd tp02 && ../display-and-grade-labday.sh )
    ( cd tp03 && ../display-and-grade-labday.sh )
    ( cd tp04 && ../display-and-grade-labday.sh )
    ( cd tp05 && ../display-and-grade-labday.sh )
    ( cd tp06 && ../display-and-grade-labday.sh )
    ( cd tp07 && ../display-and-grade-labday.sh )
    ( cd tp08 && ../display-and-grade-labday.sh )
    ( cd tp09 && ../display-and-grade-labday.sh )
    ( cd tp10 && ../display-and-grade-labday.sh )
    ( cd tp11 && ../display-and-grade-labday.sh )
    ( cd tp12 && ../display-and-grade-labday.sh )
    ( cd tp13 && ../display-and-grade-labday.sh )
    ( cd tp14 && ../display-and-grade-labday.sh )
   
COLLECTING THE GRADES

  for tp in tp{0{1,2,3,4,5,6,7,8,9},1{0,1,2,3}} ; do 
    ( cd ${tp} && ( echo "#" >> notas-hdr.txt; echo "#" >> notas-tlr.txt ; ../make-labday-grades-file.sh ) ) ;
  done

RUNNING THE LABS
    
  Build images/movies and their index pages. Manually:
  
    make-static-lab.sh tp00
    make-static-lab.sh tp01
    make-static-lab.sh tp02
    
  ALl of them:

    tps=( `gawk '/^tp/{ print $1; }' labs-info.txt` )
    ans=( `gawk '/^tp/{ print $3; }' labs-info.txt` )
    
    for i in `seq 0 $(( ${#tps[@]} - 1))` ; do 
      if [[ "/${ans[$i]}" == "/S" ]]; then which="static" ; else which="movie"; fi
      make-${which}-lab.sh ${tps[$i]}
    done

CREATING DEFAULT GRADE FILES

  make-initial-grade-files.sh tp{0{1,2,3,4,5,6,7,8,9},1{0,1,2,3}}
  
  Checking:
  
  for tp in tp{0{1,2,3,4,5,6,7,8,9},1{0,1}} ; do 
    echo "=== ${tp} ==="
    for ra in `list-ras.sh` ; do 
      printf "%s: " "${ra}"
      cat ${tp}/${ra}/nota.txt
    done
  done

>>> STOPPED HERE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

CREATING MASTER INDEX 

  make-all-labs-index-page.sh `ls -d tp?? | sort `

CHECKING TP?? EDITS

  Comparing the tp?? hand-ins with the hand-out ("tp??/main-hand-out.pov"):
  
    for ra in `list-ras.sh` ; do 
      echo "=== ${ra} ========================================="
      prdiff -Bb tp??/main-hand-out.pov tp??/${ra}/main-orig.pov
    done

IDENTIFYING ABSENTEES

  export handin="/home/stolfilocal/public_html/cursos/MC937-2017-1-A/progs/hand-in"
  
  cd ${handin}
  for tp in tp{0{6,7,8,9},1{0,1,2,3,4}} ; do 
    echo "=== ${tp} ==="
    pushd ${tp}
    ( find -name 'main.pov' -print ) \
      | sed -e 's:/main.pov.*$::g' \
      | sed -e 's:[.]/::g' \
      | sort | uniq \
      > .pres
    list-ras.sh \
      | sort | uniq \
      > .ras
    bool 1-2 .ras .pres > .absent 
    cat .absent
    popd
  done

======================================================================
JUNK

>>> NOT APPLICABLE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

  Fixing references to "retalho.inc":
  
    for tp in 12 13 14 ; do 
      ( cd tp${tp} && ln -s ../retalho-uv.inc && ln -s ../retalho-simples.inc )
      if [[ "/${tp}" == "/${14}" ]]; then qual="uv"; else qual="simples"; fi
      if [[ -d tp${tp} ]]; then 
        if [[ -f tp${tp}/retalho.inc ]]; then mv -vi tp${tp}/retalho.inc tp${tp}/retalho-old.inc; fi
        rm -f tp${tp}/retalho.inc
        ( cd tp${tp} && ln -s ../retalho-uv.inc && ln -s ../retalho-simples.inc )
        ( cd tp${tp} && ln -s retalho-${qual}.inc retalho.inc )
        for ra in `list-ras.sh` ; do 
          ( cd tp${tp}/${ra} && ln -s ../retalho.inc )
        done
      fi
    done

  !!! UPDATE FOR 2014

  Get dates of missing labs and usernames of students: 
  
    map-field \
        -v inField=2 \
        -v outField=3 \
        -v default=XXX \
        -v table=tp-to-date.tbl \
      < .stulabs-not \
      > .stulabs-not-date
      
  Get usernames of students