@vonaffenfels/contentful-teasermanager 1.2.9 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_base_slate-editor_src_dev_testComponents_TestStory2_js.js +94 -0
- package/dist/_base_slate-editor_src_dev_testComponents_TestStory3_js.js +94 -0
- package/dist/_base_slate-editor_src_dev_testComponents_TestStory_js.js +94 -0
- package/dist/index.html +12 -0
- package/dist/index.js +64938 -0
- package/package.json +3 -3
- package/src/components/Contentful/Dialog/LogicEditor.js +503 -503
- package/src/queryFromLogic.js +28 -28
package/src/queryFromLogic.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
export const queryFromLogic = (logic) => {
|
|
2
|
-
const orTags = logic.tags.filter(v => v.type === "or").map(v => v.id);
|
|
3
|
-
const andTags = logic.tags.filter(v => v.type === "and").map(v => v.id);
|
|
4
|
-
const timeZoneOffsetInHours = new Date().getTimezoneOffset() / 60;
|
|
5
|
-
const differenceToGermanTime = timeZoneOffsetInHours + 2;
|
|
6
|
-
const hours = [...(logic.timepoints || [])].map(v => parseInt(v)).sort((a, b) => a - b);
|
|
7
|
-
let nearestPassedTime = hours.reverse().find(v => v <= new Date().getHours() + differenceToGermanTime);
|
|
8
|
-
const logicQuery = {"fields.portal": logic.project};
|
|
9
|
-
|
|
10
|
-
if (!nearestPassedTime) {
|
|
11
|
-
nearestPassedTime = hours.at(0) || 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (orTags.length) {
|
|
15
|
-
logicQuery["fields.tags.sys.id[in]"] = orTags.join(",");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (andTags.length) {
|
|
19
|
-
logicQuery["fields.tags.sys.id[all]"] = andTags.join(",");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (nearestPassedTime && hours.length) {
|
|
23
|
-
logicQuery["fields.date[lte]"] = new Date(new Date().setHours(
|
|
24
|
-
nearestPassedTime + differenceToGermanTime, 0, 0, 0,
|
|
25
|
-
)).toISOString();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return logicQuery;
|
|
1
|
+
export const queryFromLogic = (logic) => {
|
|
2
|
+
const orTags = logic.tags.filter(v => v.type === "or").map(v => v.id);
|
|
3
|
+
const andTags = logic.tags.filter(v => v.type === "and").map(v => v.id);
|
|
4
|
+
const timeZoneOffsetInHours = new Date().getTimezoneOffset() / 60;
|
|
5
|
+
const differenceToGermanTime = timeZoneOffsetInHours + 2;
|
|
6
|
+
const hours = [...(logic.timepoints || [])].map(v => parseInt(v)).sort((a, b) => a - b);
|
|
7
|
+
let nearestPassedTime = hours.reverse().find(v => v <= new Date().getHours() + differenceToGermanTime);
|
|
8
|
+
const logicQuery = {"fields.portal": logic.project};
|
|
9
|
+
|
|
10
|
+
if (!nearestPassedTime) {
|
|
11
|
+
nearestPassedTime = hours.at(0) || 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (orTags.length) {
|
|
15
|
+
logicQuery["fields.tags.sys.id[in]"] = orTags.join(",");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (andTags.length) {
|
|
19
|
+
logicQuery["fields.tags.sys.id[all]"] = andTags.join(",");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (nearestPassedTime && hours.length) {
|
|
23
|
+
logicQuery["fields.date[lte]"] = new Date(new Date().setHours(
|
|
24
|
+
nearestPassedTime + differenceToGermanTime, 0, 0, 0,
|
|
25
|
+
)).toISOString();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return logicQuery;
|
|
29
29
|
};
|