Skip to content

Commit

Permalink
Merge pull request #7847 from opengovsg/release_v6.158.0
Browse files Browse the repository at this point in the history
build: release v6.158.0
  • Loading branch information
kevin9foong authored Nov 5, 2024
2 parents 98e8789 + 2426d28 commit 9f8e80d
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 38 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v6.157.0](https://github.com/opengovsg/FormSG/compare/v6.157.0...v6.157.0)
#### [v6.158.0](https://github.com/opengovsg/FormSG/compare/v6.157.0...v6.158.0)

- build: merge release v6.157.0 to develop [`#7846`](https://github.com/opengovsg/FormSG/pull/7846)
- fix: change email summary response row to represent table row instead of cell [`#7836`](https://github.com/opengovsg/FormSG/pull/7836)
- fix(deps): bump jose from 4.15.5 to 5.9.6 [`#7800`](https://github.com/opengovsg/FormSG/pull/7800)
- fix: set table field required false to cols instead of whole field [`#7839`](https://github.com/opengovsg/FormSG/pull/7839)
- build: release v6.157.0 [`#7837`](https://github.com/opengovsg/FormSG/pull/7837)

#### [v6.157.0](https://github.com/opengovsg/FormSG/compare/v6.156.0...v6.157.0)

Expand All @@ -16,7 +22,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- chore(deps-dev): bump @types/lodash from 4.17.12 to 4.17.13 in /shared [`#7832`](https://github.com/opengovsg/FormSG/pull/7832)
- chore: update test snapshot [`#7831`](https://github.com/opengovsg/FormSG/pull/7831)
- build: release v6.156.0 [`#7828`](https://github.com/opengovsg/FormSG/pull/7828)
- chore: bump version to v6.157.0 [`07f0867`](https://github.com/opengovsg/FormSG/commit/07f0867d4ec34fef38b19fc12aa45ba0d6712910)
- chore: bump version to v6.157.0 [`1dc8b83`](https://github.com/opengovsg/FormSG/commit/1dc8b83e8767aa862fc978d72cfd9f033f0e3648)

#### [v6.156.0](https://github.com/opengovsg/FormSG/compare/v6.155.0...v6.156.0)

Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-frontend",
"version": "6.157.0",
"version": "6.158.0",
"homepage": ".",
"type": "module",
"private": true,
Expand Down
29 changes: 14 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "FormSG",
"description": "Form Manager for Government",
"version": "6.157.0",
"version": "6.158.0",
"homepage": "https://form.gov.sg",
"authors": [
"FormSG <[email protected]>"
Expand Down Expand Up @@ -105,7 +105,7 @@
"http-status-codes": "^2.3.0",
"intl-tel-input": "~12.4.0",
"ip": "^1.1.9",
"jose": "^4.15.5",
"jose": "^5.9.6",
"jsdom": "^25.0.1",
"json-stringify-safe": "^5.0.1",
"JSONStream": "^1.3.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ const mapSuggestedFormFieldToFieldCreateDto = (
return {
fieldType: BasicField.Table,
title: tableFormField.title,
required: tableFormField.required,
required: true,
description: tableFormField.description ?? '',
columns: tableFormField.columns.map((colTitle) => {
// Only support short text columns for now
return {
title: colTitle,
required: true,
required: tableFormField.required,
columnType: BasicField.ShortText,
ValidationOptions: {
customVal: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,22 @@ describe('multirespondent-submission.utils', () => {
const formFields: FormFieldSchema[] = [
{
_id: '1',
title: 'Table',
title: 'Table of Name and Age',
fieldType: BasicField.Table,
columns: [
{ _id: 'col1', title: 'Name' },
{ _id: 'col2', title: 'Age' },
],
} as ITableFieldSchema,
{
_id: '2',
title: 'Table of Hobbies',
fieldType: BasicField.Table,
columns: [
{ _id: 'col3', title: 'Hobby' },
{ _id: 'col4', title: 'Years' },
],
} as ITableFieldSchema,
]
const responses: FieldResponsesV3 = {
'1': {
Expand All @@ -286,15 +295,34 @@ describe('multirespondent-submission.utils', () => {
{ col1: 'Bob', col2: '25' },
],
} as TableResponseV3,
'2': {
fieldType: BasicField.Table,
answer: [
{ col3: 'Swimming', col4: '5' },
{ col3: 'Reading', col4: '10' },
],
} as TableResponseV3,
}

const result = getQuestionTitleAnswerString({ formFields, responses })

expect(result).toEqual([
{ question: '[Table] Row 1: Name', answer: 'Alice' },
{ question: '[Table] Row 1: Age', answer: '30' },
{ question: '[Table] Row 2: Name', answer: 'Bob' },
{ question: '[Table] Row 2: Age', answer: '25' },
{
question: '[Table] Table of Name and Age (Name; Age)',
answer: 'Alice; 30',
},
{
question: '[Table] Table of Name and Age (Name; Age)',
answer: 'Bob; 25',
},
{
question: '[Table] Table of Hobbies (Hobby; Years)',
answer: 'Swimming; 5',
},
{
question: '[Table] Table of Hobbies (Hobby; Years)',
answer: 'Reading; 10',
},
])
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,29 @@ export const getQuestionTitleAnswerString = ({
{} as Record<string, string>,
)

for (const [index, row] of response.answer.entries()) {
for (const [colId, colAns] of Object.entries(row)) {
if (!(colId in idToColTitleMap)) continue
const colTitle = idToColTitleMap[colId]

questionAnswerPair.push({
question: `[Table] Row ${index + 1}: ${colTitle}`,
answer: colAns ?? '',
for (const row of response.answer) {
const validColumns = Object.entries(row).filter(
([colId]) => colId in idToColTitleMap,
)

const delimitedColumnTitles = validColumns
.map(([colId]) => {
const colTitle = idToColTitleMap[colId]
return `${colTitle}`
})
}
.join('; ')

const delimitedColumnAnswers = validColumns
.map(([, colAns]) => colAns ?? '')
.join('; ')

const question = `[Table] ${formField.title} (${delimitedColumnTitles})`
const answer = delimitedColumnAnswers

questionAnswerPair.push({
question,
answer,
})
}
continue
case BasicField.Radio:
Expand Down

0 comments on commit 9f8e80d

Please sign in to comment.