Difference between revisions of "Dev/Results"

(fix table width for mainpage styling)
(better error reporting)
Line 81: Line 81:
 
}
 
}
 
return arrayOfTeamAwards;
 
return arrayOfTeamAwards;
 +
}
 +
 +
//Helper to display a message in the body of the table (eventually overwritten by team data).
 +
function showInTable(text) {
 +
$("#table_team tbody").empty();
 +
if (typeof text == "string") {
 +
$("#table_team tbody").append("<tr><td colspan='3'>" + text + "</td></tr>");
 +
}
 
}
 
}
  
Line 86: Line 94:
 
jQuery(document).ready(function() {
 
jQuery(document).ready(function() {
 
$("#title-year").html(currentYear);
 
$("#title-year").html(currentYear);
$("#table_team tbody").empty().append("<tr><td colspan='3'>Loading...</td></tr>");
+
// $("#table_team tbody").empty().append("<tr><td colspan='3'>Loading...</td></tr>");
 +
showInTable("Loading...");
 
 
 
//Request team data
 
//Request team data
Line 96: Line 105:
 
data: {command: "get_team_list", year: currentYear},
 
data: {command: "get_team_list", year: currentYear},
 
error: function(jqxhr, textStatus, errorThrown) {
 
error: function(jqxhr, textStatus, errorThrown) {
alert("Failed to get list of teams. look at var teamsRequest");
+
console.log("Failed to get list of teams. look at var teamsRequest");
 +
showInTable("Error loading list of teams. Please check your internet connection and try again. If the problem persists, contact iGEM HQ.");
 
}
 
}
 
});
 
});
Line 107: Line 117:
 
data: {year: currentYear},
 
data: {year: currentYear},
 
error: function(jqxhr, textStatus, errorThrown) {
 
error: function(jqxhr, textStatus, errorThrown) {
alert("AJAX error; look at var awardsRequest");
+
console.log("AJAX error; look at var awardsRequest");
 +
showInTable("Error loading competition results. Please check your internet connection and try again. If the problem persists, contact iGEM HQ.");
 
}
 
}
 
});
 
});
Line 113: Line 124:
 
//When both requests finish, parse the data and set up the table.
 
//When both requests finish, parse the data and set up the table.
 
jQuery.when(teamsRequest, awardsRequest).done(function(teamsReqResult, awardsReqResult) {
 
jQuery.when(teamsRequest, awardsRequest).done(function(teamsReqResult, awardsReqResult) {
$("#table_team tbody").empty();
+
showInTable();
 
var teamsData = teamsReqResult[0];
 
var teamsData = teamsReqResult[0];
 
var awardsData = awardsReqResult[0];
 
var awardsData = awardsReqResult[0];

Revision as of 02:31, 28 September 2015

Comprehensive Results from iGEM

View: | [Africa] [Asia] [Europe] [Latin America][other?]

Team Medal Award
Please enable JavaScript in your browser to view results.