1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

price cache

This commit is contained in:
Peng DU 2016-06-21 16:04:44 +02:00
parent 4d0d3d6af0
commit 85a40db603
6 changed files with 4 additions and 8 deletions

View File

@ -8,7 +8,7 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state",
### PUBLIC SCOPE ### ### PUBLIC SCOPE ###
## List of machines prices (not considering any plan) ## List of machines prices (not considering any plan)
$scope.machinesPrices = machinesPricesPromise.prices $scope.machinesPrices = machinesPricesPromise
## List of trainings pricing ## List of trainings pricing
$scope.trainingsPricings = trainingsPricingsPromise $scope.trainingsPricings = trainingsPricingsPromise

View File

@ -4,7 +4,7 @@ Application.Services.factory 'Price', ["$resource", ($resource)->
$resource "/api/prices/:id", $resource "/api/prices/:id",
{}, {},
query: query:
isArray: false isArray: true
update: update:
method: 'PUT' method: 'PUT'
compute: compute:

View File

@ -2,7 +2,7 @@ class API::TrainingsPricingsController < API::ApiController
before_action :authenticate_user! before_action :authenticate_user!
def index def index
@trainings_pricings = TrainingsPricing.includes(:training) @trainings_pricings = TrainingsPricing.all
end end
def update def update

View File

@ -1,3 +1,2 @@
json.extract! price, :id, :group_id, :plan_id, :priceable_type, :priceable_id json.extract! price, :id, :group_id, :plan_id, :priceable_type, :priceable_id
json.amount price.amount / 100.0 json.amount price.amount / 100.0
json.priceable_name price.priceable.name

View File

@ -1,3 +1,3 @@
json.cache! @prices do json.cache! @prices do
json.prices @prices, partial: 'api/prices/price', as: :price json.partial! 'api/prices/price', collection: @prices, as: :price
end end

View File

@ -1,5 +1,2 @@
json.extract! trainings_pricing, :id, :group_id, :training_id json.extract! trainings_pricing, :id, :group_id, :training_id
json.amount trainings_pricing.amount / 100.0 json.amount trainings_pricing.amount / 100.0
json.training do
json.name trainings_pricing.training.name
end