Difference between revisions of "HQ:Code Test"

Line 1,038: Line 1,038:
 
 
 
 
 +
var trim_text="";
 
//navigate the data array
 
//navigate the data array
 
for(x=0; x < data.length; x++){
 
for(x=0; x < data.length; x++){
Line 1,060: Line 1,061:
 
//if this team is listed in the awards/nominations, add accordingly  
 
//if this team is listed in the awards/nominations, add accordingly  
 
if( data[x].team_name == award[z].team_name){
 
if( data[x].team_name == award[z].team_name){
 +
 +
 +
//trim any extra text
 +
if(award[z].section == 'high_school' || award[z].section == 'overgrad'){
 +
trim_text = (award[z].award).substring(13, ((award[z].award).indexOf(",")));
 +
}
 +
else{
 +
trim_text = award[z].award;
 +
}
 +
 
 
 
//nomination
 
//nomination
 
if ( (award[z].award).substring(0,9) == "Nominated" ) {
 
if ( (award[z].award).substring(0,9) == "Nominated" ) {
 
 
+
//if the team has any other nominations or not, add accordingly
if(award[z].section == 'high_school' || award[z].section == 'overgrad'){
+
if ( data[x].nominations == null){
+
data[x].nominations = trim_text;
data[x].nominations += (award[z].award).substring(13, ((award[z].award).indexOf(",")));
+
 
}
 
}
 
 
else{
 
else{
data[x].nominations += award[z].award;
+
data[x].nominations += ","+trim_text;
 
}
 
}
 
 
 
nominations_assigned = true;
 
nominations_assigned = true;
 
}  
 
}  
 +
 
 
 
//award
 
//award
 
else if ( (award[z].award).substring(0,4) == "Best" ) {  
 
else if ( (award[z].award).substring(0,4) == "Best" ) {  
 
 
+
//if the team has any other awards or not, add accordingly
 +
if ( data[x].awards == null){
 +
data[x].awards= trim_text;
 +
}
 +
else{
 +
data[x].awards+= ","+trim_text;
 +
}
 
 
 
award_assigned  = true;
 
award_assigned  = true;
 
}
 
}
+
 
+
 
}
 
}
 
 

Revision as of 19:10, 13 September 2019

Loading...

Code setup page

This page will help you setup the awards and results page

  1. Place the awards and medals into a excel file to create the variable notation
  2. Place the variables indicated on the code on this page
  3. Place the resulting data bases into the results and all teams info pages