Created
May 24, 2018 12:19
-
-
Save ville6000/58ae3db1a3077c7e6cdbb0e08101356a to your computer and use it in GitHub Desktop.
MMArmy record by organization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var record = {}; | |
jQuery('.record').find('tr').each(function(idx, el) { | |
var row = jQuery(el); | |
var key = (row.find('td:first-child').hasClass('win') || row.find('td:first-child').hasClass('winTitle')) ? 'wins' : 'losses'; | |
var organization = row.find('td').eq(7).text(); | |
if (idx > 0) { | |
if (typeof record[organization] === 'undefined') { | |
record[organization] = { | |
wins: 0, | |
losses: 0 | |
}; | |
} | |
record[organization][key]++ | |
} | |
}); | |
console.log(record); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment