Method: Sufia::UserStatImporter#sorted_users

Defined in:
lib/sufia/models/stats/user_stat_importer.rb

#sorted_usersObject

Returns an array of users sorted by the date of their last stats update. Users that have not been recently updated will be at the top of the array.



39
40
41
42
43
44
45
# File 'lib/sufia/models/stats/user_stat_importer.rb', line 39

def sorted_users
  users = []
  ::User.find_each do |user|
    users.push(UserRecord.new(user.id, user.user_key, date_since_last_cache(user)))
  end
  users.sort { |a, b| a.last_stats_update <=> b.last_stats_update }
end