Commit e841e3c7 authored by William Paul Liggett's avatar William Paul Liggett

Log Data to CSV: Built a way to detect a rare instance where a network outage...

Log Data to CSV: Built a way to detect a rare instance where a network outage would not be reported.
parent 75b5be45
......@@ -54,6 +54,11 @@
<p><em>Estimated labor time: <span id="hours_logged_for_update_15">0.5</span> hours.</em></p>
<ul>
<li>Log Data to CSV: Ensured that the user's activity data will not breach PHP's max_input_vars setting.</li>
<li>
Log Data to CSV: Built a way to detect a rare instance where a network outage would not be reported.
But, I now force an error message if this incident occurs, with the test data captured for manual
processing to occur. This way there should be absolutely no way that a participant's test data will be lost.
</li>
</ul>
<p class="version_info">Version 1.7.3 (2018-03-09 to 2018-03-17):</p>
......
......@@ -241,6 +241,14 @@ var ov_participant_response_time = -1;
$("#vigilance_display_banner_text").html("Submitting the test data...");
$("#vigilance_display_extra_text").html("Please wait to ensure your test data has been processed correctly.");
// If any kind of Ajax error occurs at all, the script may get to a weird point where it won't properly inform the
// participant that there was a problem as there are mulitple Ajax requests going on. Therefore, if this variable is
// ever set to `true' then we'll make sure to activate the report_ajax_error() function to be on the safe-side.
var ajax_any_error_whatsoever = false;
// Used to monitor how many times the report_ajax_error() function was called from within an $.ajax() function.
var report_ajax_error_func_used_count = 0;
// If an Ajax error occurs, the report_ajax_error() function may not see the full breadcrumb trail of Ajax responses.
// This is used to build up a string of each Ajax response, to include this in the report_ajax_error() details.
var ajax_sequence_response_trail = "<br /><br />";
......@@ -251,6 +259,16 @@ var ov_participant_response_time = -1;
// Internal function only used if there was an Ajax failure for some reason.
function report_ajax_error(detailed_error_message = "") {
ajax_any_error_whatsoever = true;
report_ajax_error_func_used_count++;
// Rarely this might be blank, such that an Ajax error occured but then another Ajax request completed and all
// looks well when this isn't really the case. So, we'll at least provide a few details to help with debugging.
if(detailed_error_message === "") {
detailed_error_message = "Number of Ajax errors: " + report_ajax_error_func_used_count +
ajax_sequence_response_trail;
}
// Converts the User Activity Log/Random Letter Log arrays into strings.
// Explains to the user they should save the page as an ".html" file and to email it to William.
$("#vigilance_display_banner_text").html("Network Failure");
......@@ -377,6 +395,12 @@ var ov_participant_response_time = -1;
ajax_sequence_response_trail);
}
});
// Rarely needed, but essential if something goes weird with submitting the data to the server via Ajax.
// Ensures that if an Ajax error occurred, that we don't accidentally report that the CSV files were created correctly.
if((ajax_any_error_whatsoever) && $("#vigilance_display_banner_text").html() !== "Network Failure") {
report_ajax_error();
}
}
// An event is a random letter change set to the rate of EVENTS_PER_MINUTE.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment