aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-12-09 16:11:22 +0000
committerGodin <mandrikov@gmail.com>2010-12-09 16:11:22 +0000
commitde9ca79d393fbeaa06288529e7c9c800a4b3b286 (patch)
treebee432d7fedcb3b2fcb47d802cf3ec96a919fc39 /sonar-server/src
parent337a1b5251924bfe12d52c8b49ce0a8eae020446 (diff)
downloadsonarqube-de9ca79d393fbeaa06288529e7c9c800a4b3b286.tar.gz
sonarqube-de9ca79d393fbeaa06288529e7c9c800a4b3b286.zip
SONAR-833: New Web Service to get history of measures (time machine)
Diffstat (limited to 'sonar-server/src')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb
index cf34d238d0d..d69372155d7 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb
@@ -20,7 +20,6 @@
class Api::TimemachineController < Api::ApiController
MAX_IN_ELEMENTS=990
#
- # TODO date range
# GET /api/timemachine
#
def index
@@ -28,6 +27,8 @@ class Api::TimemachineController < Api::ApiController
resource_id = params[:resource]
metric_keys = params[:metrics].split(',')
metrics = Metric.by_keys(metric_keys)
+ first_date = parse_datetime(params[:first_date])
+ last_date = parse_datetime(params[:last_date])
@resource=Project.by_key(resource_id)
if @resource.nil?
@@ -35,7 +36,8 @@ class Api::TimemachineController < Api::ApiController
end
snapshots = Snapshot.find(:all,
- :conditions => {:project_id => @resource.id, :status => Snapshot::STATUS_PROCESSED},
+ :conditions => ['created_at>=? AND created_at<=? AND project_id=? AND status=?',
+ first_date, last_date, @resource.id, Snapshot::STATUS_PROCESSED],
:order => 'created_at')
# Oracle limitation : no more than 1000 elements in IN clause