Changeset 551 in tmcsimulator for trunk/webapps/einotebook/script/scrollframe.js


Ignore:
Timestamp:
12/26/2019 03:14:52 PM (6 years ago)
Author:
jdalbey
Message:

Multi-file commit to implement saving evaluation ratings from einotebook to a log file and merging with unified log. Also fix defect #212. cgi-bin/saveEvals.py cgi-bin/saveRatingsToLog.py common/js/displayutils.js common/js/fileutils.js common/js/revision_number.dat common/unifiedlog.css dynamicdata/CADcomments.log dynamicdata/caddetails.csv dynamicdata cms_messages.json dynamicdata/har_messages.json dynamicdata highway_status.json dynamicdata/ratings.csv dynamicdata/unifiedlog.csv dynamicdata/unifiedlog_final.csv einotebook/roles/index.html einotebook roles/roles.js einotebook/script/index.html einotebook/script scrollframe.js einotebook/scripts/Evaluation.js einotebook/scripts/Event.js mergelogs.bash unifiedlogdisplay.html unifiedlogmonitor.html

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/webapps/einotebook/script/scrollframe.js

    r548 r551  
    1212} 
    1313 
     14// Collect all the ratings from the events  
    1415function collectRatings()  
    1516{ 
     17    var output = "" 
     18    var ratingCount = 0 
    1619    // Consider each event in the incident script 
    1720    for (var evtidx = 0; evtidx < events.length; evtidx++) 
     
    2730                // If it not the default value we want to save it 
    2831                if (item.rating > 0) 
    29                 { 
    30                     console.log("collecting event"+evtidx + " at " + events[evtidx].time.format() +" "+item.type + " " + item.rating) 
     32                {   // Build a string for the log in this format: 
     33                    //03:01:00, Evaluation, CMS, Poor 
     34                    output += events[evtidx].time.format() +", Evaluation, "+item.type + ", " + item.ratingQualities[item.rating] + "\n" 
     35                    ratingCount += 1;   
    3136                } 
    3237            } 
    3338        } 
    3439    } 
     40    submitRatings(output); 
     41    alert(ratingCount + " rating were saved.") 
    3542} 
    3643 
     
    5562*/ 
    5663 
    57 // TODO 
    58 function submitRatings() 
     64// Send the string of ratings to the server 
     65function submitRatings(logString) 
    5966{ 
    6067        // Using POST to send the data  
    6168        var xhr = new XMLHttpRequest(); 
    62         xhr.open("POST", "../../cgi-bin/saveRatings.py", true); 
     69        xhr.open("POST", "/cgi-bin/saveRatingsToLog.py", true); 
    6370        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 
    6471        // send the collected data 
    65         xhr.send("msg="+outString); 
     72        xhr.send("msg="+logString); 
    6673} 
Note: See TracChangeset for help on using the changeset viewer.