Changeset 631 in tmcsimulator for trunk/webapps/einotebook/scripts/Evaluation.js


Ignore:
Timestamp:
02/03/2021 06:19:49 AM (5 years ago)
Author:
jdalbey
Message:

appendRatingToLog.py evalratings.csv New files added for #251.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/webapps/einotebook/scripts/Evaluation.js

    r551 r631  
    44 * @param data Array(label1, text1, label2, text2, ...) 
    55 */ 
    6 function Evaluation(type, data) 
     6function Evaluation(type, evttime, data) 
    77{ 
    88    //========== private static members ==========// 
     
    1616    this.type = type; 
    1717    this.data = data; 
     18    this.evttime = evttime; 
    1819     
    1920    //========== public read-only members ==========// 
     
    2526    this.recordText = recordText;  
    2627    this.recordRating = recordRating; 
     28    this.writeRating = writeRating; 
    2729     
    2830    //========== private methods ==========// 
     
    7072     
    7173    /** 
    72      * Stores the rating given by the evaluation scale radio button form. 
     74     * Stores the rating given by the evaluation scale radio button form. --OBSOLETE 
    7375     */ 
    7476    function recordRating(givenRating)  
     
    7779        this.rating = givenRating; 
    7880        //console.log(this.ratingGroupName + " recordRating of " + this.rating ) 
     81    } 
     82    /** 
     83     * Write an individual rating to a log file 
     84     */ 
     85    function writeRating(givenRating) 
     86    { 
     87        //alert("writeRating: " + givenRating + " : " + this.evttime.format()) 
     88        // Build a string for the log in this format: 
     89        //03:01:00, Evaluation, CMS, Poor 
     90        logString = this.evttime.format() + ", Evaluation, " + this.type + ", " + this.ratingQualities[givenRating] + "\n" 
     91        // Using POST to send the data  
     92        var xhr = new XMLHttpRequest(); 
     93        xhr.open("POST", "/cgi-bin/appendRatingToLog.py", true); 
     94        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 
     95        // send the collected data 
     96        xhr.send("msg="+logString); 
    7997    } 
    8098 
     
    113131                       (this.rating == 5 ? "checked='true'" : "") +  
    114132                       " onchange='events.getEvaluation(" + this.id +  
    115                        ").recordRating(5)' name='" + this.ratingGroupName +  
    116                        "' value='1'></td>" + 
     133                       ").writeRating(5)' name='" + this.ratingGroupName +  
     134                       "' value='5'></td>" + 
    117135               "<td align='center'><input type='radio' " +  
    118136                       (this.rating == 4 ? "checked='true'" : "") +  
    119137                       " onchange='events.getEvaluation(" + this.id +  
    120                        ").recordRating(4)' name='" + this.ratingGroupName +  
    121                        "' value='2'></td>" + 
     138                       ").writeRating(4)' name='" + this.ratingGroupName +  
     139                       "' value='4'></td>" + 
    122140               "<td align='center'><input type='radio' " +  
    123141                       (this.rating == 3 ? "checked='true'" : "") +  
    124142                       " onchange='events.getEvaluation(" + this.id +  
    125                        ").recordRating(3)' name='" + this.ratingGroupName +  
     143                       ").writeRating(3)' name='" + this.ratingGroupName +  
    126144                       "' value='3'></td>" + 
    127145               "<td align='center'><input type='radio' " +  
    128146                       (this.rating == 2 ? "checked='true'" : "") +  
    129147                       " onchange='events.getEvaluation(" + this.id +  
    130                        ").recordRating(2)' name='" + this.ratingGroupName +  
    131                        "' value='4'></td>" + 
     148                       ").writeRating(2)' name='" + this.ratingGroupName +  
     149                       "' value='2'></td>" + 
    132150               "<td align='center'><input type='radio' " +  
    133151                       (this.rating == 1 ? "checked='true'" : "") +  
    134152                       " onchange='events.getEvaluation(" + this.id +  
    135                        ").recordRating(1)' name='" + this.ratingGroupName +  
    136                        "' value='5'></td>" + 
     153                       ").writeRating(1)' name='" + this.ratingGroupName +  
     154                       "' value='1'></td>" + 
    137155               "</tr>" + 
    138156               "</table>"  + 
Note: See TracChangeset for help on using the changeset viewer.