Difference between revisions of "HQ:Code Test"

Line 2: Line 2:
 
<html>
 
<html>
  
 
+
 +
<div id="HQ_info">
 +
<div class="column full_size">
 +
 +
 +
</div>
 +
</div>
 +
 +
 
<script>
 
<script>
  
Line 15: Line 23:
  
 
************************************************************************************************************/
 
************************************************************************************************************/
 +
  
 
$(document).ready(function() {
 
$(document).ready(function() {
Line 1,015: Line 1,024:
 
 
 
var medal_assigned = false;
 
var medal_assigned = false;
 +
var award_assigned = false;
 +
var nominations_asigned = false;
 +
 
 
 
//navigate the data array
 
//navigate the data array
Line 1,027: Line 1,039:
 
}
 
}
 
 
 +
//if team didn't win a medal
 
if(medal_assigned == false){
 
if(medal_assigned == false){
 
data[x].medal = '-';
 
data[x].medal = '-';
 
}
 
}
 
 
+
//navigate the awards array
+
for(z=0; z < award.length; z++){
 +
 +
 +
//if this team is listed in the awards/nominations, add accordingly
 +
if( data[x].team_name == award[z].team_name){
 +
 +
//nomination
 +
if ( (award[z].award).substring(0,9) == "Nominated" ) {
 +
 +
 +
if(award[z].section == 'high_school' || award[z].section == 'overgrad'){
 +
 +
data[x].nominations = (award[z].award).substring(13, ((award[z].award).indexOf(",")));
 +
}
 +
 +
else{
 +
data[x].nominations = award[z].award;
 +
}
 +
 +
nominations_asigned = true;
 +
}
 +
 +
//award
 +
else if ( (award[z].award).substring(0,4) == "Best" ) {
 +
 +
 +
 +
award_assigned = true;
 +
}
 +
 +
 +
}
 +
 +
 +
//if the team wasnt nominated
 +
if(nominations_asigned == false){
 +
data[x].nominations = '-';
 +
}
 +
 +
//if the didnt win an award
 +
if(award_asigned == false){
 +
data[x].awards = '-';
 +
}
 +
 +
 +
}
 
 
 
}
 
}
 
 
console.log(data);
 
  
 +
console.log(data);
 
 
 
 
 
}
 
}
 
  
  
Line 1,047: Line 1,104:
  
  
 +
</div>
 
</html>
 
</html>
 
{{Footer2019}}
 
{{Footer2019}}

Revision as of 18:34, 13 September 2019

Loading...