html5-infobeamer-dhcp/assets/js/custom/services/service.js

56 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-01-08 21:32:04 +01:00
'use strict';
2024-02-20 01:15:46 +01:00
import * as lodash from "../../lodash/lodash-core.js";
2024-01-08 21:32:04 +01:00
import * as sol from "../../solight/sol.js";
const process_data = (scheduleFile) =>
sol.processScheduleFile(scheduleFile);
const event_modus_string = (event) => {
const questionId = 1392;
const answers = sol.eventAnswers(event);
const answer = answers.filter(a => a.get('question') === questionId);
const modus = answer.length > 0 ? answer[0].get('answer') : '???';
return modus;
};
const trackIndexMap = new Map([
['Andere', 0],
['Ethik, Wissenschaft, Kultur & Gesellschaft', 1],
['Recht & Politik', 2],
2024-02-20 01:15:46 +01:00
['Netzwerke, Security, Hard- & Software', 3],
['Digitale Selbstverteidigung', 4]]);
2024-01-08 21:32:04 +01:00
const track_index = (track) =>
trackIndexMap.get(track);
2024-02-20 01:15:46 +01:00
const sort_tracks = (tracks) =>
lodash.sortBy(tracks, track_index);
2024-01-08 21:32:04 +01:00
const person_names_concat = (persons) =>
// persons.map(p => sol.personName(p)).join(', ');
// persons.map(p => sol.personName(p)).join(' & ');
persons.map(p => sol.personName(p)).join(' · ');
const ndash_fix_regexp = RegExp('\\s+-\\s+');
const ndash_fix_replacement = ' ';
const fix_dash = (string) =>
string.replace(ndash_fix_regexp, ndash_fix_replacement);
export {
process_data,
event_modus_string,
track_index,
2024-02-20 01:15:46 +01:00
sort_tracks,
2024-01-08 21:32:04 +01:00
person_names_concat,
fix_dash
}