fixes
This commit is contained in:
@@ -7,6 +7,11 @@ meta:
|
||||
folding:
|
||||
previewFolded: titleForWork
|
||||
previewUnfolded: titleForWork
|
||||
metaElements:
|
||||
- maxWidth
|
||||
- iconBackgroundImage
|
||||
- iconBackgroundTitle
|
||||
- noGap
|
||||
subFields:
|
||||
- name: title
|
||||
type: string
|
||||
@@ -42,6 +47,8 @@ subFields:
|
||||
previewFolded: contentType
|
||||
previewUnfolded: contentType
|
||||
direction: horizontal
|
||||
metaElements:
|
||||
|
||||
subFields:
|
||||
- name: contentType
|
||||
type: string
|
||||
@@ -76,6 +83,7 @@ subFields:
|
||||
type: object
|
||||
meta:
|
||||
label: Boxenliste
|
||||
widget: containerLessObject
|
||||
dependsOn:
|
||||
eval: $parent.contentType == 'boxlist'
|
||||
subFields:
|
||||
@@ -93,6 +101,7 @@ subFields:
|
||||
type: object
|
||||
meta:
|
||||
label: Icon Informationsbrett
|
||||
widget: containerLessObject
|
||||
dependsOn:
|
||||
eval: $parent.contentType == 'iconInfoBoard'
|
||||
subFields:
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
// @ts-ignore
|
||||
delete tempForm[undefined]
|
||||
context.smtp.sendMail({
|
||||
to: "allkids.erfurt@gmail.com",
|
||||
to: "info@allkids-erfurt.de",
|
||||
from: "mail@webmakers.de",
|
||||
subject: "AllKids " + formTitle,
|
||||
html: context.tpl.execute(context.fs.readFile("templates/form_mail.html"), {
|
||||
|
||||
@@ -3,6 +3,7 @@ const { apiClientBaseURL } = require("../config-client")
|
||||
/**
|
||||
* convert object to string
|
||||
* @param {any} obj object
|
||||
* @returns {Object | undefined}
|
||||
*/
|
||||
function obj2str(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
|
||||
@@ -9,6 +9,7 @@ function log(str) {
|
||||
/**
|
||||
* convert object to string
|
||||
* @param {any} obj object
|
||||
* @returns {Object | undefined}
|
||||
*/
|
||||
function obj2str(obj) {
|
||||
if (Array.isArray(obj)) {
|
||||
@@ -46,16 +47,22 @@ function clearSSRCache() {
|
||||
var info = context.db.deleteMany("ssr", {})
|
||||
context.response.header("X-SSR-Cleared", info.removed)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{ [x: string]: any; }[]} dbObjs
|
||||
*/
|
||||
function calculateAverageDynamically(dbObjs) {
|
||||
const sumObj = {}
|
||||
let count = 0
|
||||
|
||||
dbObjs.forEach((obj) => {
|
||||
dbObjs.forEach((/** @type {{ [x: string]: any; }} */ obj) => {
|
||||
accumulate(obj, sumObj)
|
||||
count++
|
||||
})
|
||||
|
||||
/**
|
||||
* @param {{ [x: string]: any; }} sourceObj
|
||||
* @param {{ [x: string]: any; }} targetObj
|
||||
*/
|
||||
function accumulate(sourceObj, targetObj) {
|
||||
for (const key in sourceObj) {
|
||||
if (typeof sourceObj[key] === "number") {
|
||||
@@ -67,6 +74,9 @@ function calculateAverageDynamically(dbObjs) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{ [x: string]: any; }} targetObj
|
||||
*/
|
||||
function average(targetObj) {
|
||||
for (const key in targetObj) {
|
||||
if (typeof targetObj[key] === "number") {
|
||||
@@ -81,6 +91,9 @@ function calculateAverageDynamically(dbObjs) {
|
||||
return sumObj
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
*/
|
||||
function run(url) {
|
||||
const response = context.http
|
||||
.fetch(url, {
|
||||
@@ -133,6 +146,7 @@ function setUpQuery(subPath = "/") {
|
||||
|
||||
let query = `${api}?`
|
||||
for (let key in parameters) {
|
||||
// @ts-ignore
|
||||
query += `${key}=${parameters[key]}&`
|
||||
}
|
||||
query += params // Append other parameters without URL encoding
|
||||
|
||||
@@ -7,6 +7,7 @@ var { setUpQuery, calculateAverageDynamically, run } = require("../lib/utils")
|
||||
}
|
||||
let dbObjs = []
|
||||
urls.forEach((url) => {
|
||||
console.log("URL:", url)
|
||||
dbObjs.push(run(url))
|
||||
})
|
||||
let dbObject = calculateAverageDynamically(dbObjs)
|
||||
|
||||
Reference in New Issue
Block a user