Last active
August 29, 2015 14:15
-
-
Save kungfuant/d22d8bd3a2f303a67cf1 to your computer and use it in GitHub Desktop.
Repair MP games
This file contains 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 fs = require('fs'); | |
var readline = require('readline'); | |
var fp = process.argv[2]; | |
var st = fs.createReadStream(fp, 'utf8'); | |
var rl = readline.createInterface({input: st}); | |
rl.on('line', function(line) { | |
var fields = line.split(','); | |
var id = parseInt(fields[0]); | |
var room = parseInt(fields[1]); | |
var sato = parseInt(fields[2]); | |
var crash = Math.round(100 * sato / room); | |
console.log("UPDATE games SET game_crash =", crash, "WHERE id =", id + ";"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment