|
|
|
@ -38,6 +38,7 @@ module Api |
|
|
|
|
|
|
|
|
|
before_filter :find_project_by_project_id, |
|
|
|
|
:authorize, :except => [:index] |
|
|
|
|
before_filter :parse_changed_since, only: [:index] |
|
|
|
|
before_filter :assign_planning_elements, :except => [:index, :update, :create] |
|
|
|
|
|
|
|
|
|
# Attention: find_all_projects_by_project_id needs to mimic all of the above |
|
|
|
@ -207,13 +208,9 @@ module Api |
|
|
|
|
|
|
|
|
|
def current_work_packages(projects) |
|
|
|
|
work_packages = WorkPackage.for_projects(projects) |
|
|
|
|
.changed_since(@since) |
|
|
|
|
.includes(:status, :project, :type) |
|
|
|
|
|
|
|
|
|
if params[:changed_since] |
|
|
|
|
since = Time.at(Float(params[:changed_since]).to_i) rescue render_400 |
|
|
|
|
work_packages = work_packages.where(["updated_at >= ?", since]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
if params[:f] |
|
|
|
|
query = Query.new |
|
|
|
|
query.add_filters(params[:f], params[:op], params[:v]) |
|
|
|
@ -283,6 +280,14 @@ module Api |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
|
|
def parse_changed_since |
|
|
|
|
if params[:changed_since] |
|
|
|
|
@since = Time.at(Float(params[:changed_since]).to_i) rescue render_400 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|