Sha256: bac3020f66c9c389de25bafa97e4a5fd0ffc55d03f68c716cc7504d2322d6d76
Contents?: true
Size: 730 Bytes
Versions: 4
Compression:
Stored size: 730 Bytes
Contents
require_relative '../utils/db_utils' require_relative '../config/constants' class Statistic attr_reader :game def self.generate_stats(game) { name: game.player_name, difficulty: game.difficulty_name, attempts_total: DIFFICULTIES[game.difficulty_name.to_sym][:attempts], attempts_used: DIFFICULTIES[game.difficulty_name.to_sym][:attempts] - game.attempts, hints_total: DIFFICULTIES[game.difficulty_name.to_sym][:hints], hints_used: DIFFICULTIES[game.difficulty_name.to_sym][:hints] - game.hints } end def self.sort_stats stats.sort_by { |player| [player[:attempts_total], player[:attempts_used], player[:hints_used]] } end def self.stats DbUtils.get(DB) end end
Version data entries
4 entries across 4 versions & 1 rubygems