<commit_before>require 'time'

module WebRebellion; class Proposal
  attr_reader :initiator

  def initialize(initiator, players, roles)
    @initiator = initiator
    @players = players.map { |p| [p, false] }.to_h
    @roles = roles.freeze
    @time = Time.now.to_i
  end

  def assert_in_game(player)
    raise "#{player} not in game" unless @players.has_key?(player)
  end

  def accept(player)
    assert_in_game(player)
    @players[player] = true
  end

  def decline(player)
    assert_in_game(player)
    @players.delete(player)
    # Reset everyone else's acceptances
    @players.each_key { |k| @players[k] = false }
  end

  def everyone_accepted?
    @players.values.all?
  end

  def serialize
    {
      initiator: @initiator.username,
      players: @players.keys.map(&:username),
      roles: @roles,
      time: @time,<commit_msg>Proposal: Show declined players<commit_after>require 'time'

module WebRebellion; class Proposal
  attr_reader :initiator

  def initialize(initiator, players, roles)
    @initiator = initiator
    @original_players = players.map(&:username)
    @players = players.map { |p| [p, false] }.to_h
    @declined_players = {}
    @roles = roles.freeze
    @time = Time.now.to_i
  end

  def assert_in_game(player)
    raise "#{player} not in game" unless @players.has_key?(player)
  end

  def accept(player)
    assert_in_game(player)
    @players[player] = true
  end

  def decline(player)
    assert_in_game(player)
    @declined_players[player.username] = Time.now.to_i
    @players.delete(player)
    # Reset everyone else's acceptances
    @players.each_key { |k| @players[k] = false }
  end

  def everyone_accepted?
    @players.values.all?
  end

  def serialize
    {
      initiator: @initiator.username,
      original_players: @original_players,
      players: @players.keys.map(&:username),
      declined_players: @declined_players,
      roles: @roles,
      time: @time,
{'fraction_non_alphanumeric': 0.11243523316062176, 'fraction_numerical': 0.0, 'mean_word_length': 3.378684807256236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1182935', 'n_tokens_mistral': 693, 'n_tokens_neox': 677, 'n_words': 147}