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

[frontend] Fixing default value of payload argument not set up #1675

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,58 +163,58 @@ const CreateInjectDetails = ({
if (hasExpectations && injectDetailsState.expectations) {
finalData.expectations = injectDetailsState.expectations;
}
if (openDetails) {
contractContent.fields
.filter(
(f) => !['teams', 'assets', 'assetgroups', 'articles', 'challenges', 'attachments', 'expectations'].includes(
f.key,
),
)
.forEach((field) => {
if (field.type === 'number') {
finalData[field.key] = parseInt(data[field.key], 10);
} else if (
field.type === 'textarea'

contractContent.fields
.filter(
(f) => !['teams', 'assets', 'assetgroups', 'articles', 'challenges', 'attachments', 'expectations'].includes(
f.key,
),
)
.forEach((field) => {
if (field.type === 'number') {
finalData[field.key] = parseInt(data[field.key], 10);
} else if (
field.type === 'textarea'
&& field.richText
&& data[field.key]
&& data[field.key].length > 0
) {
finalData[field.key] = data[field.key]
.replaceAll(
'<#list challenges as challenge>',
'<#list challenges as challenge>',
)
.replaceAll(
'&lt;#list articles as article&gt;',
'<#list articles as article>',
)
.replaceAll('&lt;/#list&gt;', '</#list>');
} else if (data[field.key] && field.type === 'tuple') {
if (field.cardinality && field.cardinality === '1') {
if (finalData[field.key].type === 'attachment') {
finalData[field.key] = {
key: data[field.key].key,
value: `${field.tupleFilePrefix}${data[field.key].value}`,
};
} else {
finalData[field.key] = R.dissoc('type', data[field.key]);
}
) {
finalData[field.key] = data[field.key]
.replaceAll(
'&lt;#list challenges as challenge&gt;',
'<#list challenges as challenge>',
)
.replaceAll(
'&lt;#list articles as article&gt;',
'<#list articles as article>',
)
.replaceAll('&lt;/#list&gt;', '</#list>');
} else if (data[field.key] && field.type === 'tuple') {
if (field.cardinality && field.cardinality === '1') {
if (finalData[field.key].type === 'attachment') {
finalData[field.key] = {
key: data[field.key].key,
value: `${field.tupleFilePrefix}${data[field.key].value}`,
};
} else {
finalData[field.key] = data[field.key].map((pair) => {
if (pair.type === 'attachment') {
return {
key: pair.key,
value: `${field.tupleFilePrefix}${pair.value}`,
};
}
return R.dissoc('type', pair);
});
finalData[field.key] = R.dissoc('type', data[field.key]);
}
} else {
finalData[field.key] = data[field.key];
finalData[field.key] = data[field.key].map((pair) => {
if (pair.type === 'attachment') {
return {
key: pair.key,
value: `${field.tupleFilePrefix}${pair.value}`,
};
}
return R.dissoc('type', pair);
});
}
});
}
} else {
finalData[field.key] = data[field.key];
}
});

const { allTeams, teamsIds, assetIds, assetGroupIds, documents } = injectDetailsState;
const inject_depends_duration = data.inject_depends_duration_days * 3600 * 24
+ data.inject_depends_duration_hours * 3600
Expand Down