Skip to content
This repository
Browse code

Add is_open attribute to track bug status.

  • Loading branch information...
commit 93f144fd8fde03262206a717e5664772ce984c97 1 parent d7996fe
Zuhao Wan authored
2  app/models/bug.rb
... ...
@@ -1,5 +1,5 @@
1 1
 class Bug < ActiveRecord::Base
2  
-  attr_accessible :name, :bz_id, :is_review
  2
+  attr_accessible :name, :bz_id, :is_review, :is_open
3 3
   belongs_to :fedora_rpm
4 4
 
5 5
   def url
13  app/models/fedora_rpm.rb
@@ -107,7 +107,7 @@ def retrieve_versions
107 107
       begin
108 108
         rpm_spec = URI.parse(spec_url).read
109 109
         is_patched = (rpm_spec.scan(/\nPatch0:\s*.*\n/).size != 0)
110  
-        
  110
+
111 111
         rpm_version = rpm_spec.scan(/\nVersion:\s*.*\n/).first.split.last
112 112
         if !version_valid?(rpm_version)
113 113
           if rpm_version.include?('%{majorver}')
@@ -122,19 +122,19 @@ def retrieve_versions
122 122
         rv.is_patched = is_patched
123 123
         self.rpm_versions << rv
124 124
         if version_title == 'rawhide'
125  
-          #Import the maintainer's e-mail            
  125
+          #Import the maintainer's e-mail
126 126
           fedora_user_list = rpm_spec.scan(/<.*[@].*>/)
127 127
           fedora_user_list.each do |user|
128 128
             if user != "<rel-eng@lists.fedoraproject.org>" #We don't want to add Fedora Release Engineering
129 129
               #Remove those "<>"
130 130
               user[0] = ""
131  
-              user.gsub!(">", "")                  
  131
+              user.gsub!(">", "")
132 132
               self.fedora_user = user
133 133
               break
134 134
             end
135 135
           end
136 136
           puts "Maintainer: #{self.fedora_user}"
137  
-            
  137
+
138 138
           self.homepage = rpm_spec.scan(/\nURL:\s*.*\n/).first.split.last
139 139
 
140 140
           rpm_spec.split("\n").each { |line|
@@ -180,11 +180,12 @@ def retrieve_bugs
180 180
     xmlrpc = Bugzilla::XMLRPC.new("bugzilla.redhat.com")
181 181
     bugs = Bugzilla::Bug.new(xmlrpc).search("summary" => name, "product" => "fedora")["bugs"]
182 182
     bugs.each { |bug|
183  
-      arb = Bug.new 
  183
+      arb = Bug.new
184 184
       arb.name = bug["summary"]
185 185
       arb.bz_id = bug["id"]
186 186
       arb.last_updated = bug["last_change_time"].to_time
187 187
       arb.is_review = true if arb.name =~ /^Review Request.*#{name}\s.*$/
  188
+      arb.is_open = bug['is_open']
188 189
       self.bugs << arb
189 190
     }
190 191
   end
@@ -285,7 +286,7 @@ def self.build_rpms(spec_file)
285 286
     }
286 287
     rpms
287 288
   end
288  
-  
  289
+
289 290
   def obfuscated_fedora_user
290 291
     return self.fedora_user.to_s.gsub("@", " AT ").gsub(".", " DOT ")
291 292
   end
5  app/views/fedorarpms/show.html.haml
@@ -98,7 +98,10 @@
98 98
           - @rpm.bugs.each do |b|
99 99
             %tr
100 100
               %td
101  
-                = link_to b.bz_id, b.url
  101
+                - if b.is_open
  102
+                  = link_to b.bz_id, b.url
  103
+                - else
  104
+                  %strike= link_to b.bz_id, b.url
102 105
               %td
103 106
                 = b.name.truncate(30)
104 107
               %td{:style => "text-align: center;"}
5  db/migrate/20130312132803_add_is_open_to_bugs.rb
... ...
@@ -0,0 +1,5 @@
  1
+class AddIsOpenToBugs < ActiveRecord::Migration
  2
+  def change
  3
+    add_column :bugs, :is_open, :boolean
  4
+  end
  5
+end
3  db/schema.rb
@@ -11,7 +11,7 @@
11 11
 #
12 12
 # It's strongly recommended to check this file into your version control system.
13 13
 
14  
-ActiveRecord::Schema.define(:version => 20130103111220) do
  14
+ActiveRecord::Schema.define(:version => 20130312132803) do
15 15
 
16 16
   create_table "bugs", :force => true do |t|
17 17
     t.string   "name"
@@ -21,6 +21,7 @@
21 21
     t.datetime "created_at",    :null => false
22 22
     t.datetime "updated_at",    :null => false
23 23
     t.string   "last_updated"
  24
+    t.boolean  "is_open"
24 25
   end
25 26
 
26 27
   create_table "builds", :force => true do |t|

0 notes on commit 93f144f

Please sign in to comment.
Something went wrong with that request. Please try again.