Changeset 80570
- Timestamp:
- 07/14/11 23:35:23 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gsoc11-statistics/stats-server/app/controllers/submissions_controller.rb
r80569 r80570 36 36 xcode_version = os['xcode_version'] 37 37 38 # Try andfind an existing entry38 # Try to find an existing entry 39 39 os_stats = OsStatistic.find_by_user_id(user.id) 40 40 … … 59 59 end 60 60 61 def add_port_data(uuid, ports) 62 logger.debug "In add_port_data" 61 def add_port(uuid, macports_port, installed_port, month, year) 62 logger.debug {"Adding installed port #{installed_port['name']}"} 63 64 portEntry = InstalledPort.new(:uuid => uuid, 65 :port_id => macports_port.id, 66 :version => installed_port['version'], 67 :variants => installed_port['variants'], 68 :month => month, 69 :year => year) 70 71 if not portEntry.save 72 logger.debug "Unable to save port #{port['name']}" 73 logger.debug "Error message: #{portEntry.errors.full_messages}" 74 end 75 end 76 77 def add_installed_ports(uuid, installed_ports) 78 logger.debug "In add_installed_ports" 63 79 64 if ports.nil?80 if installed_ports.nil? 65 81 return 66 82 end … … 70 86 year = current_time.year 71 87 72 ports.each do |port| 73 logger.debug {"Adding port #{port}"} 74 port_id = 5 75 portEntry = InstalledPort.new(:uuid => uuid, 76 :port_id => port_id, 77 :version => port['version'], 78 :variants => port['variants'], 79 :month => month, 80 :year => year) 81 82 if not portEntry.save 83 logger.debug "Unable to save port #{port['name']}" 84 logger.debug "Error message: #{portEntry.errors.full_messages}" 85 end 88 installed_ports.each do |installed_port| 89 # Find the reported port in the MacPorts repository 90 macports_port = Port.find_by_name(installed_port['name']) 91 92 if macports_port.nil? 93 logger.debug {"Skipping unknown port #{installed_port['name']} - Not in MacPorts repository"} 94 next 95 end 96 97 # Update installed port information 98 add_port(uuid, macports_port, installed_port, month, year) 86 99 end 87 100 end … … 97 110 98 111 add_os_data(user, os) 99 add_ port_data(json['id'], active_ports)112 add_installed_ports(json['id'], active_ports) 100 113 101 114 respond_to do |format|
Note: See TracChangeset
for help on using the changeset viewer.

