Skip to content

Instantly share code, notes, and snippets.

@siman-man
Created March 5, 2022 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siman-man/b1e009050403390f65ec6b290843d14b to your computer and use it in GitHub Desktop.
Save siman-man/b1e009050403390f65ec6b290843d14b to your computer and use it in GitHub Desktop.
parse mm ranking json file.
require 'json'
require 'time'
user_name = 'simanman'
body = JSON.parse(File.read('ranking.json'))
submissions = body.select { |b| b['createdBy'] == user_name }
submissions.sort_by! { |sub| Time.parse(sub['submittedDate']) }
last_sub = submissions.last
last_sub['reviewSummation'][0]['metadata']['testScores'].each do |row|
puts "seed: %12d, score: %8d" % [row['testcase'], row['score']]
end
puts last_sub['reviewSummation'][0]['aggregateScore']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment