Skip to content

Commit b011ce9

Browse files
committed
PROD-3106 #comment Fix Bug hunt package details are not displayed in the WM challenge specification and challenge details page
1 parent db57744 commit b011ce9

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

src-ts/tools/work/work-detail-details/work-detail-details-pane/WorkDetailDetailsPane.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import _ from 'lodash'
33
import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react'
44
import { Link } from 'react-router-dom'
55

6-
import { currencyFormat } from '../../../../../src/utils'
7-
import { ArrowIcon, FormCard, LoadingSpinner } from '../../../../lib'
6+
import { ArrowIcon, LoadingSpinner } from '../../../../lib'
7+
import getSelectedPackageFormatted from '../../../../utils/bug-hunt'
88
import { ChallengeMetadataName, workFactoryMapFormData } from '../../work-lib'
9-
import BugHuntPricingConfig from '../../work-self-service/intake-forms/bug-hunt/bug-hunt.form.pricing-config'
109

1110
import styles from './WorkDetailDetailsPane.module.scss'
1211

@@ -108,15 +107,4 @@ function checkIsEmpty(detail: Array<string> | {} | string): boolean {
108107
.filter((val) => val?.trim().length > 0).length === 0)
109108
}
110109

111-
const getSelectedPackageFormatted: (packageId: string) => string = (packageId) => {
112-
const currentPackage: FormCard | undefined = BugHuntPricingConfig.find((pricingConfig) => pricingConfig.id === packageId)
113-
if (currentPackage) {
114-
const deviceType: string = currentPackage.sections?.[0]?.rows?.[3]?.text || ''
115-
const noOfTesters: string = `${currentPackage.sections?.[0]?.rows?.[2]?.text || 0} testers`
116-
return `${currentPackage.title} - ${currencyFormat(currentPackage.price)} - ${deviceType} - ${noOfTesters}`
117-
}
118-
119-
return packageId
120-
}
121-
122110
export default WorkDetailDetailsPane

src-ts/tools/work/work-lib/work-provider/work-functions/work-factory/work.factory.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import moment from 'moment'
2+
import getSelectedPackageFormatted from '../../../../../../utils/bug-hunt'
23

34
import { WorkConfigConstants, WorkStrings } from '../../../work-constants'
45
import {
@@ -302,7 +303,7 @@ function buildFormDataBugHunt(formData: any): ReadonlyArray<FormDetail> {
302303
{
303304
key: ChallengeMetadataName.packageType,
304305
title: ChallengeMetadataTitle.bugHuntPackage,
305-
value: formData.packageType,
306+
value: getSelectedPackageFormatted(formData.packageType),
306307
},
307308
]
308309
}

src-ts/utils/bug-hunt/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { currencyFormat } from "../../../src/utils"
2+
import { FormCard } from "../../lib"
3+
import BugHuntPricingConfig from "../../tools/work/work-self-service/intake-forms/bug-hunt/bug-hunt.form.pricing-config"
4+
5+
function getSelectedPackageFormatted(packageId: string): string {
6+
const currentPackage: FormCard | undefined = BugHuntPricingConfig.find((pricingConfig) => pricingConfig.id === packageId)
7+
if (currentPackage) {
8+
const deviceType: string = currentPackage.sections?.[0]?.rows?.[3]?.text || ''
9+
const noOfTesters: string = `${currentPackage.sections?.[0]?.rows?.[2]?.text || 0} testers`
10+
return `${currentPackage.title} - ${currencyFormat(currentPackage.price)} - ${deviceType} - ${noOfTesters}`
11+
}
12+
13+
return packageId
14+
}
15+
16+
export default getSelectedPackageFormatted

0 commit comments

Comments
 (0)