Changeset 80569
- Timestamp:
- 07/14/11 23:13:50 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gsoc11-statistics/stats-server/app/controllers/submissions_controller.rb
r80511 r80569 21 21 22 22 # Populate an OsStatistics row based on submitted JSON data 23 def add_os_data(u uid, os)23 def add_os_data(user, os) 24 24 logger.debug "In add_os_data" 25 25 … … 36 36 xcode_version = os['xcode_version'] 37 37 38 @os_stats = OsStatistic.new(:uuid => uuid, 39 :macports_version => macports_version, 40 :osx_version => osx_version, 41 :os_arch => os_arch, 42 :os_platform => os_platform, 43 :build_arch => build_arch, 44 :gcc_version => gcc_version, 45 :xcode_version => xcode_version) 46 if not @os_stats.save 38 # Try and find an existing entry 39 os_stats = OsStatistic.find_by_user_id(user.id) 40 41 if os_stats.nil? 42 # No entry for this user - create a new one 43 os_stats = OsStatistic.new() 44 end 45 46 os_stats[:user_id] = user.id 47 os_stats[:macports_version] = macports_version 48 os_stats[:osx_version] = osx_version 49 os_stats[:os_arch] = os_arch 50 os_stats[:os_platform] = os_platform 51 os_stats[:build_arch] = build_arch 52 os_stats[:gcc_version] = gcc_version 53 os_stats[:xcode_version] = xcode_version 54 55 if not os_stats.save 47 56 logger.debug "Unable to save os_stats" 48 logger.debug "Error message: #{ @os_stats.errors.full_messages}"57 logger.debug "Error message: #{os_stats.errors.full_messages}" 49 58 end 50 59 end … … 84 93 os = json['os'] 85 94 active_ports = json['active_ports'] 86 add_os_data(json['id'], os) 95 96 user = User.find_or_create_by_uuid(json['id']) 97 98 add_os_data(user, os) 87 99 add_port_data(json['id'], active_ports) 88 100
Note: See TracChangeset
for help on using the changeset viewer.

