Method: Organizations#assignment_groups

Defined in:
lib/actions/orgs.rb

#assignment_groups(client, config) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/actions/orgs.rb', line 114

def assignment_groups(client,config)
  team=Teams.new()
  groupslist=team.get_groupslist(config)
  groupsadd=[]
  teamlist=team.read_teamlist(client,config)

  puts "\n"
  puts "Groups currently available:\n\n"
  puts groupslist
  puts "\nAdd groups to your assignment (Press enter to skip): "
  op=gets.chomp
  if op==""
    puts "Do you want to create a new group? (Press any key to preceed, or only enter to skip)"
    an=gets.chomp

    if an!=""
      time=Time.new
      puts "Put the name of the group (If you skip with enter, the group's name will be \"Group-#{time.ctime}\")"
      name=gets.chomp
      if name==""
         name="Group-#{time.ctime}"
         name=name.split(" ").join("-")
      end
      puts "Teams currently available:\n\n"
      teamlist.each do |aux|
        print "#{aux[0]} "
      end
      puts "\n\nPut a list of Teams: "

      list=gets.chomp
      list=list.split(" ")
      team.new_group(client,config,name,list)
      groupsadd.push(name)
    else
      groupsadd=[]
    end

  else
    groupsadd=op.split(" ")
    groupsadd.each do |item|
      if groupslist.detect{|aux| aux==item}==nil
        groupsadd.delete(item)
      end
    end
  end
  return groupsadd
end