diff --git a/web/app/assets/javascripts/networkTestHelper.js b/web/app/assets/javascripts/networkTestHelper.js index 2c7437515..3d6c69688 100644 --- a/web/app/assets/javascripts/networkTestHelper.js +++ b/web/app/assets/javascripts/networkTestHelper.js @@ -175,14 +175,17 @@ function renderStopTestAudio(score, text) { if(!score || score.length == 0) { - $scoredClientsAudio.html('?'); + $scoredClientsAudio.html('0'); + + $inProgressText.text('The audio test did not pass. Video is not tested in this case.'); + } else { $scoredClientsAudio.html(score); } if(text && text.length > 0) { - $audioResultText.html(text).show(); + $audioResultText.text(text); } $testResults.removeClass('testing'); $testScoreAudio.removeClass('testing'); @@ -191,16 +194,23 @@ function renderStopTestVideo(score, text) { logger.debug("renderStopTestVideo", score, text) + + // don't show the audio result text until the test is over (it looks confusing otherwise). + if($audioResultText.text() && $audioResultText.text().length > 0) { + $audioResultText.show(); + } + + $inProgressText.text('Your router and Internet service will support:') + if(!score || score.length == 0) { $scoredClientsVideo.html('?'); } else { - $scoredClientsVideo.html('0') - $inProgressText.text('Your router and Internet service will support:') - if(score < 2) { + $scoredClientsVideo.html('0') $videoResultText.html('No other players when in a video + audio session.').show(); + $testScoreVideo.addClass('acceptable'); } else { $scoredClientsVideo.html(score); @@ -406,10 +416,15 @@ testSummary.video_final = {reason: attempt.reason}; } + // a score of '2' is a failure when we take error paths in this function. Because we alway decrement the num_clients by 1 (and < 2 is considered failure). Also , we start the testing at 2. so it's probably correct anyway + if (!testSummary.video_final.num_clients) { + testSummary.video_final.num_clients = 2; + } + var reason = testSummary.video_final.reason; var success = false; - logger.debug("testFinishedVideo", testSmmary) + logger.debug("testFinishedVideo", testSummary) if (reason == "success") { renderStopTestVideo(attempt.num_clients, null) @@ -426,11 +441,14 @@ } context.jamClient.SetVideoNetworkTestScore(attempt.num_clients); - if (testSummary.video_final.num_clients >= 2) { + if (!testSummary.video_final.num_clients) { + $testScoreVideo.addClass('acceptable'); + } + else if (testSummary.video_final.num_clients >= 2) { $testScoreVideo.addClass('good'); } else { - $testScoreVideo.addClass('bad'); + $testScoreVideo.addClass('acceptable'); } success = true; }