<commit_before>module Backend
  module Groups
    extend self
    def create(groupname:, usernames:)
      group = Group.new
      group.groupname = groupname
      group.users << usernames.map{ |username| User.where(username: username).first }
      group.save!
      group #TODO: do we need a dead_group or something here?
    end
  end
end<commit_msg>Added add member method to the backend class<commit_after>module Backend
  module Groups
    extend self
    def create(groupname:, members:)
      group = Group.new
      group.groupname = groupname
      group.users << usernames.map{ |username| User.where(username: username).first }
      group.save!
      group #TODO: do we need a dead_group or something here?
    end

    def add_member(username:, groupname:)
      user = Users.user_by_username username: username
      group = group_by_groupname groupname: groupname
      group.users << user
      group.save!
    end

    def group_by_groupname(groupname:)
      Group.find_by! groupname: groupname
    end
  end
end
{'fraction_non_alphanumeric': 0.07856450048496605, 'fraction_numerical': 0.0, 'mean_word_length': 2.9692307692307693, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4130786', 'n_tokens_mistral': 308, 'n_tokens_neox': 302, 'n_words': 91}