mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-02 01:02:55 +00:00
feat: add propcat and formfield for Studienkategorie
This commit is contained in:
26
scripts/studien-edit.js
Normal file
26
scripts/studien-edit.js
Normal file
@ -0,0 +1,26 @@
|
||||
let text = getFieldValue('studienalle');
|
||||
let json = [];
|
||||
let newJson = [];
|
||||
|
||||
try {
|
||||
json = JSON.parse(getFieldValue('studienallejson'));
|
||||
if (!Array.isArray(json)) {
|
||||
json = [];
|
||||
}
|
||||
} catch (e) {
|
||||
json = [];
|
||||
}
|
||||
|
||||
if (typeof text === 'string' || text instanceof String) {
|
||||
text.split('\n').forEach(line => {
|
||||
let id = line.split(';')[0];
|
||||
json.forEach(entry => {
|
||||
if (id === entry.nct) {
|
||||
newJson.push(entry);
|
||||
}
|
||||
});
|
||||
});
|
||||
setFieldValue('studienallejson', JSON.stringify(newJson));
|
||||
} else {
|
||||
setFieldValue('studienallejson', JSON.stringify([]));
|
||||
}
|
Reference in New Issue
Block a user