Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supplement tags #1381

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Small fix for tags write functionality for HDF type inputs
Signed-off-by: Gavin Mason <75515923+GavMason@users.noreply.github.com>
GavMason committed May 4, 2023
commit 4baa6effe6d947992b9862e67c9d7a07cd8aae95
7 changes: 4 additions & 3 deletions src/commands/supplement/tags/write.ts
Original file line number Diff line number Diff line change
@@ -51,9 +51,10 @@ export default class WriteTags extends Command {
throw new TypeError('Structure of tags data is invalid')
}

for (const profile of (input as ExecJSON.Execution).profiles) {
for (const [i, profile] of (input as ExecJSON.Execution).profiles.entries()) {
const currTags = tags[i]
for (const control of profile.controls) {
const matchingTag = tags[0].find((tag: { gid: string }) => tag.gid === control.id)
const matchingTag = currTags.find((tag: { gid: string }) => tag.gid === control.id)
if (matchingTag !== undefined) {
control.tags = matchingTag
}
@@ -65,7 +66,7 @@ export default class WriteTags extends Command {
}

for (const control of (input as ProfileJSON.Profile).controls) {
const matchingTag = tags[0].find((tag: { gid: string }) => tag.gid === control.id)
const matchingTag = tags.find((tag: { gid: string }) => tag.gid === control.id)
if (matchingTag !== undefined) {
control.tags = matchingTag
}