Skip to content

Commit 7b1a8b9

Browse files
authored
🐛 [Frontend] Fix: Service's Pricing Plans (#8035)
1 parent 6237988 commit 7b1a8b9

File tree

1 file changed

+12
-4
lines changed
  • services/static-webserver/client/source/class/osparc/store

1 file changed

+12
-4
lines changed

services/static-webserver/client/source/class/osparc/store/Services.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,15 @@ qx.Class.define("osparc.store.Services", {
349349
},
350350

351351
getPricingPlan: function(serviceKey, serviceVersion) {
352-
const serviceUrl = osparc.data.Resources.getServiceUrl(serviceKey, serviceVersion)
352+
const serviceUrl = osparc.data.Resources.getServiceUrl(serviceKey, serviceVersion);
353+
const key = serviceUrl["key"];
354+
const version = serviceUrl["version"];
353355
// check if the service is already cached
354-
if (serviceUrl in this.__pricingPlansCached) {
355-
return Promise.resolve(this.__pricingPlansCached[serviceUrl]);
356+
if (
357+
key in this.__pricingPlansCached &&
358+
version in this.__pricingPlansCached[key]
359+
) {
360+
return Promise.resolve(this.__pricingPlansCached[key][version]);
356361
}
357362

358363
const plansParams = {
@@ -361,7 +366,10 @@ qx.Class.define("osparc.store.Services", {
361366
return osparc.data.Resources.fetch("services", "pricingPlans", plansParams)
362367
.then(pricingPlansData => {
363368
// store the fetched pricing plans in the cache
364-
this.__pricingPlansCached[serviceUrl] = pricingPlansData;
369+
if (!(key in this.__pricingPlansCached)) {
370+
this.__pricingPlansCached[key] = {};
371+
}
372+
this.__pricingPlansCached[key][version] = pricingPlansData;
365373
return pricingPlansData;
366374
});
367375
},

0 commit comments

Comments
 (0)