Guest User

Untitled

a guest
Mar 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. function gymCallback(results2, status2) {
  2. var totalRating = 0,
  3. ratedCount = 0;
  4.  
  5. results2.forEach(function( place ) {
  6. if (place.rating !== undefined) {
  7. ratedCount++;
  8. totalRating += place.rating;
  9. }
  10. });
  11.  
  12.  
  13. var averageRating = results2.length == 0 ? 0 : totalRating / ratedCount;
  14. var averageRatingRounded = averageRating.toFixed(1);
  15.  
  16.  
  17. var averageGymRatingTB = document.getElementById('gymAvgRating');
  18. averageGymRatingTB.value = averageRatingRounded;
  19. }
  20.  
  21. <p>
  22. Gyms: &nbsp; &nbsp; &nbsp; &nbsp;
  23. <input type="text" size="10" name="gymAvgRating" id="gymAvgRating" />
  24. </p>
  25.  
  26. <li data-toggle="collapse" data-target="#fitness" class="collapsed">
  27. <a onclick="clearMarkers();GymReport();" href="#"><i class="fa fa-heart fa-lg"></i> Fitness <span
  28. class="arrow"></span></a>
  29. </li>
Add Comment
Please, Sign In to add comment