Skip to content

Commit

Permalink
Add is_open attribute to track bug status.
Browse files Browse the repository at this point in the history
  • Loading branch information
zuhao committed Mar 12, 2013
1 parent d7996fe commit 93f144f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/models/bug.rb
@@ -1,5 +1,5 @@
class Bug < ActiveRecord::Base
attr_accessible :name, :bz_id, :is_review
attr_accessible :name, :bz_id, :is_review, :is_open
belongs_to :fedora_rpm

def url
Expand Down
13 changes: 7 additions & 6 deletions app/models/fedora_rpm.rb
Expand Up @@ -107,7 +107,7 @@ def retrieve_versions
begin
rpm_spec = URI.parse(spec_url).read
is_patched = (rpm_spec.scan(/\nPatch0:\s*.*\n/).size != 0)

rpm_version = rpm_spec.scan(/\nVersion:\s*.*\n/).first.split.last
if !version_valid?(rpm_version)
if rpm_version.include?('%{majorver}')
Expand All @@ -122,19 +122,19 @@ def retrieve_versions
rv.is_patched = is_patched
self.rpm_versions << rv
if version_title == 'rawhide'
#Import the maintainer's e-mail
#Import the maintainer's e-mail
fedora_user_list = rpm_spec.scan(/<.*[@].*>/)
fedora_user_list.each do |user|
if user != "<rel-eng@lists.fedoraproject.org>" #We don't want to add Fedora Release Engineering
#Remove those "<>"
user[0] = ""
user.gsub!(">", "")
user.gsub!(">", "")
self.fedora_user = user
break
end
end
puts "Maintainer: #{self.fedora_user}"

self.homepage = rpm_spec.scan(/\nURL:\s*.*\n/).first.split.last

rpm_spec.split("\n").each { |line|
Expand Down Expand Up @@ -180,11 +180,12 @@ def retrieve_bugs
xmlrpc = Bugzilla::XMLRPC.new("bugzilla.redhat.com")
bugs = Bugzilla::Bug.new(xmlrpc).search("summary" => name, "product" => "fedora")["bugs"]
bugs.each { |bug|
arb = Bug.new
arb = Bug.new
arb.name = bug["summary"]
arb.bz_id = bug["id"]
arb.last_updated = bug["last_change_time"].to_time
arb.is_review = true if arb.name =~ /^Review Request.*#{name}\s.*$/
arb.is_open = bug['is_open']
self.bugs << arb
}
end
Expand Down Expand Up @@ -285,7 +286,7 @@ def self.build_rpms(spec_file)
}
rpms
end

def obfuscated_fedora_user
return self.fedora_user.to_s.gsub("@", " AT ").gsub(".", " DOT ")
end
Expand Down
5 changes: 4 additions & 1 deletion app/views/fedorarpms/show.html.haml
Expand Up @@ -98,7 +98,10 @@
- @rpm.bugs.each do |b|
%tr
%td
= link_to b.bz_id, b.url
- if b.is_open
= link_to b.bz_id, b.url
- else
%strike= link_to b.bz_id, b.url
%td
= b.name.truncate(30)
%td{:style => "text-align: center;"}
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20130312132803_add_is_open_to_bugs.rb
@@ -0,0 +1,5 @@
class AddIsOpenToBugs < ActiveRecord::Migration
def change
add_column :bugs, :is_open, :boolean
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20130103111220) do
ActiveRecord::Schema.define(:version => 20130312132803) do

create_table "bugs", :force => true do |t|
t.string "name"
Expand All @@ -21,6 +21,7 @@
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "last_updated"
t.boolean "is_open"
end

create_table "builds", :force => true do |t|
Expand Down

0 comments on commit 93f144f

Please sign in to comment.