Sha256: ba331d1c63bf51074a439a2573cb17447e9239c9b24b5aac842b0f7ad9ac1fde
Contents?: true
Size: 710 Bytes
Versions: 1
Compression:
Stored size: 710 Bytes
Contents
require_relative '../utils/db_utils' require_relative '../config/constants' module Statistic 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
codebreaker_paratskiy-0.1.3 | lib/services/statistic_service.rb |