Skip to content

Commit cbffeb1

Browse files
committed
minor
1 parent d03f4ea commit cbffeb1

File tree

1 file changed

+22
-24
lines changed
  • services/static-webserver/client/source/class/osparc/store

1 file changed

+22
-24
lines changed

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

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ qx.Class.define("osparc.store.Templates", {
4343
return this.__fetchTemplatesPaginated(params, options);
4444
},
4545

46-
__fetchAllTutorials: function(params) {
46+
__fetchAllTutorials: function() {
47+
const params = {
48+
url: {
49+
"orderBy": JSON.stringify({
50+
field: "last_change_date",
51+
direction: "desc"
52+
}),
53+
}
54+
};
4755
params["url"]["templateType"] = osparc.data.model.StudyUI.TUTORIAL_TYPE;
4856
return this.__tutorialsPromiseCached = osparc.data.Resources.getInstance().getAllPages("templates", params, "getPageFilteredSorted")
4957
.then(tutorials => {
@@ -59,7 +67,15 @@ qx.Class.define("osparc.store.Templates", {
5967
});
6068
},
6169

62-
__fetchAllHypertools: function(params) {
70+
__fetchAllHypertools: function() {
71+
const params = {
72+
url: {
73+
"orderBy": JSON.stringify({
74+
field: "last_change_date",
75+
direction: "desc"
76+
}),
77+
}
78+
};
6379
params["url"]["templateType"] = osparc.data.model.StudyUI.HYPERTOOL_TYPE;
6480
return this.__hypertoolsPromiseCached = osparc.data.Resources.getInstance().getAllPages("templates", params, "getPageFilteredSorted")
6581
.then(hypertools => {
@@ -76,57 +92,39 @@ qx.Class.define("osparc.store.Templates", {
7692
},
7793

7894
getTutorials: function(useCache = true) {
79-
const params = {
80-
url: {
81-
"orderBy": JSON.stringify({
82-
field: "last_change_date",
83-
direction: "desc"
84-
}),
85-
}
86-
};
87-
8895
if (this.__tutorialsPromiseCached) {
8996
return this.__tutorialsPromiseCached;
9097
}
9198

9299
if (this.__tutorials === null) {
93100
// no tutorials cached, fetch them
94-
return this.__fetchAllTutorials(params);
101+
return this.__fetchAllTutorials();
95102
}
96103

97104
if (useCache) {
98105
// tutorials already cached, return them
99106
return new Promise(resolve => resolve(this.__tutorials));
100107
}
101108

102-
return this.__fetchAllTutorials(params);
109+
return this.__fetchAllTutorials();
103110
},
104111

105112
getHypertools: function(useCache = true) {
106-
const params = {
107-
url: {
108-
"orderBy": JSON.stringify({
109-
field: "last_change_date",
110-
direction: "desc"
111-
}),
112-
}
113-
};
114-
115113
if (this.__hypertoolsPromiseCached) {
116114
return this.__hypertoolsPromiseCached;
117115
}
118116

119117
if (this.__hypertools === null) {
120118
// no hypertools cached, fetch them
121-
return this.__fetchAllHypertools(params);
119+
return this.__fetchAllHypertools();
122120
}
123121

124122
if (useCache) {
125123
// hypertools already cached, return them
126124
return new Promise(resolve => resolve(this.__hypertools));
127125
}
128126

129-
return this.__fetchAllHypertools(params);
127+
return this.__fetchAllHypertools();
130128
},
131129
}
132130
});

0 commit comments

Comments
 (0)