Reply To: delete result file by accident

PennController for IBEX Forums Support delete result file by accident Reply To: delete result file by accident

#5888
Jeremy
Keymaster

Hi,

Yes, you can recreate the core of the results file using the raw results file. One option is to create a new empty experiment that will serve as the host for the restored results file and pass each line from raw_results to it, effectively simulating submissions.

Here’s what I just did: I parsed raw_results to delete all the lines starting with #, added a comma at the end of each of the remaining lines, and added var lines = [ at the very beginning and ]; at the very end of the whole document. Then I opened the dummy experiment as if to participate in it, I opened the javascript console and pasted the parsed content. Then I typed this in the console:

for (let i = 0; i < lines.length; i++)
	$.ajax({
        url: __server_py_script_name__,
        cache: false,
        contentType: "text/html; charset=UTF-8",
        data: JSON.stringify(lines[i]),
        type: "POST",
        success: m=>console.log("success"),
        error: e=>console.log("error",e)
    });

I refreshed the Results section of my dummy experiment and I had my results file. The MD5 hashes were different, of course, as was the information in the comments, because I made the submissions myself, but other than that the lines looked ok. I just had one submission rejected, but I identified it as line #4 (starting with 0) and was able to add it back in manually:

$.ajax({
        url: __server_py_script_name__,
        cache: false,
        contentType: "text/html; charset=UTF-8",
        data: JSON.stringify(lines[4]),
        type: "POST",
        success: m=>console.log("success"),
        error: e=>console.log("error",e)
    });

Let me know if you need assistance

Jeremy