]> source.dussan.org Git - sonarqube.git/commitdiff
[SONAR-1973] Add status and type constants
authorFabrice Bellingard <bellingard@gmail.com>
Fri, 8 Apr 2011 09:52:26 +0000 (11:52 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 20 Apr 2011 06:49:57 +0000 (08:49 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/review.rb

index c1ee0a44cdfb144ccb764d2177eb756278701ee7..464bfdde0cec225bf6fb969f784182bf6350f69a 100644 (file)
@@ -56,8 +56,8 @@ class ReviewsController < ApplicationController
                  
          @review = Review.new(params[:review])
          @review.user = current_user
-         @review.status = "open"
-         @review.review_type = "simple"
+         @review.status = Review.default_status
+         @review.review_type = Review.default_type
          @review_comment = ReviewComment.new(params[:review_comment])
          @review_comment.user = current_user
          @review.review_comments << @review_comment
index 13ee58b80feedb7b34a580ddf0a7d6fd4f5ca584..2e42efb6f15e4de20c54560d7127152909740868 100644 (file)
@@ -26,24 +26,38 @@ class Review < ActiveRecord::Base
   validates_presence_of :review_type, :message => "can't be empty"
   validates_presence_of :status, :message => "can't be empty"
 
-  INFO = "info"
-  MINOR = "minor"
-  MAJOR = "major"
-  CRITICAL = "critical"
-  BLOCKER = "blocker"
+  SEVERITY_INFO = "info"
+  SEVERITY_MINOR = "minor"
+  SEVERITY_MAJOR = "major"
+  SEVERITY_CRITICAL = "critical"
+  SEVERITY_BLOCKER = "blocker"
+  
+  TYPE_COMMENTS = "comments"
+  TYPE_FALSE_POSITIVE = "f-positive"
+  
+  STATUS_OPEN = "open"
+  STATUS_CLOSED = "closed"
 
 
   def self.default_severity
-    return MAJOR
+    return SEVERITY_MAJOR
+  end
+  
+  def self.default_type
+    return TYPE_COMMENTS
+  end
+
+  def self.default_status
+    return STATUS_OPEN
   end
   
   def self.severity_options
     severity_ops = []
-    severity_ops << ["Info", INFO]
-    severity_ops << ["Minor", MINOR]
-    severity_ops << ["Major", MAJOR]
-    severity_ops << ["Critical", CRITICAL]
-    severity_ops << ["Blocker", BLOCKER]
+    severity_ops << ["Info", SEVERITY_INFO]
+    severity_ops << ["Minor", SEVERITY_MINOR]
+    severity_ops << ["Major", SEVERITY_MAJOR]
+    severity_ops << ["Critical", SEVERITY_CRITICAL]
+    severity_ops << ["Blocker", SEVERITY_BLOCKER]
     return severity_ops
   end