brewersfan1976

smart_assigning.rb

May 31st, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.76 KB | None | 0 0
  1. def smartAssigning(information)
  2.     array_length = information.length
  3.     x = 0
  4.     projects = 0
  5.     tasks = 0
  6.     name  = ""
  7.     while (x < array_length)
  8.           if information[x][1].to_i == 1 and (information[x][3].to_i < tasks or tasks == 0) then
  9.               name = information[x][0]
  10.               projects = information[x][2].to_i
  11.               tasks = information[x][3].to_i
  12.           end
  13.        
  14.           if information[x][1].to_i == 1 and information[x][3].to_i == tasks and information[x][2].to_i < projects then
  15.               name = information[x][0]
  16.               projects = information[x][2].to_i
  17.               tasks = information[x][3].to_i
  18.           end
  19.              
  20.           x = x + 1
  21.     end
  22.              
  23.     return name
  24. end
Advertisement
Add Comment
Please, Sign In to add comment