Fixed ref problem, did break overview conditions.

This commit is contained in:
Martin Edenhofer 2012-05-02 11:44:27 +02:00
parent 5ac3ad8b8b
commit 21654d677c

View file

@ -7,20 +7,29 @@ class TicketOverviewsController < ApplicationController
# build up attributes hash # build up attributes hash
overview_selected = nil overview_selected = nil
overview_selected_raw = nil
overviews = Overview.all overviews = Overview.all
overviews.each { |overview| overviews.each { |overview|
# for cleanup reasons, remove me later!
overview.condition.each { |item, value |
if item == 'owner_id'
overview.condition[item] = 'current_user.id'
end
}
# remember selected view
if params[:view] && params[:view] == overview.meta[:url]
overview_selected = overview
overview_selected_raw = Marshal.load( Marshal.dump(overview.attributes) )
end
# replace 'current_user.id' with current_user.id # replace 'current_user.id' with current_user.id
overview.condition.each { |item, value | overview.condition.each { |item, value |
if value == 'current_user.id' if value == 'current_user.id'
overview.condition[item] = current_user.id overview.condition[item] = current_user.id
end end
} }
# remember selected view
if params[:view] && params[:view] == overview.meta[:url]
overview_selected = overview
end
} }
# sortby # sortby
@ -108,7 +117,7 @@ class TicketOverviewsController < ApplicationController
# return result # return result
render :json => { render :json => {
:overview => overview_selected, :overview => overview_selected_raw,
:tickets => tickets, :tickets => tickets,
:tickets_count => tickets_count, :tickets_count => tickets_count,
:users => users, :users => users,