Skip to content

Commit

Permalink
Fix organizations update (#1699)
Browse files Browse the repository at this point in the history
  • Loading branch information
joanagmaia authored Oct 16, 2023
1 parent fa96db5 commit 372d2f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ function findPlatform(platform) {
function onInputChange(newValue, key, value, index) {
model.value.identities[index] = {
...props.modelValue.identities[index],
name: newValue,
url: newValue.length ? `https://${value.urlPrefix}${newValue}` : null,
};
}
Expand Down
34 changes: 6 additions & 28 deletions frontend/src/modules/organization/pages/organization-form-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,17 @@ function getInitialModel(record) {
return JSON.parse(
JSON.stringify(
formSchema.initialValues({
...(record || {}),
name: record ? record.name : '',
displayName: record ? record.displayName || record.name : '',
headline: record ? record.headline : '',
description: record ? record.description : '',
joinedAt: record ? record.joinedAt : '',
employees: record ? record.employees : null,
location: record ? record.location : null,
website: record ? record.website : null,
identities: record ? [...record.identities.map((i) => ({
...i,
platform: i.platform,
name: i.name,
username: i.url ? i.url.split('/').at(-1) : '',
username: i.url ? i.url.split('/').at(-1) : null,
url: i.url,
}))] : [],
revenueRange: record ? record.revenueRange : {},
Expand All @@ -227,29 +226,6 @@ function getInitialModel(record) {
record && record.phoneNumbers?.length > 0
? record.phoneNumbers
: [''],
type: record ? record.type : null,
size: record ? record.size : null,
industry: record ? record.industry : null,
founded: record ? record.founded : null,
profiles: record ? record.profiles : null,
affiliatedProfiles: record ? record.affiliatedProfiles : null,
allSubsidiaries: record ? record.allSubsidiaries : null,
alternativeDomains: record ? record.alternativeDomains : null,
alternativeNames: record ? record.alternativeNames : null,
averageEmployeeTenure: record ? record.averageEmployeeTenure : null,
averageTenureByLevel: record ? record.averageTenureByLevel : null,
averageTenureByRole: record ? record.averageTenureByRole : null,
directSubsidiaries: record ? record.directSubsidiaries : null,
employeeChurnRate: record ? record.employeeChurnRate : null,
employeeCountByCountry: record ? record.employeeCountByCountry : null,
employeeCountByMonth: record ? record.employeeCountByMonth : null,
employeeGrowthRate: record ? record.employeeGrowthRate : null,
gicsSector: record ? record.gicsSector : null,
grossAdditionsByMonth: record ? record.grossAdditionsByMonth : null,
grossDeparturesByMonth: record ? record.grossDeparturesByMonth : null,
immediateParent: record ? record.immediateParent : null,
tags: record ? record.tags : null,
ultimateParent: record ? record.ultimateParent : null,
}),
),
);
Expand Down Expand Up @@ -377,6 +353,7 @@ function onCancel() {
async function onSubmit() {
isFormSubmitting.value = true;
const data = {
manuallyCreated: true,
...formModel.value,
Expand All @@ -388,7 +365,8 @@ async function onSubmit() {
}
return acc;
}, []),
identities: formModel.value.identities.filter((i) => i.username.length > 0).map((i) => ({
identities: formModel.value.identities.filter((i) => i.username?.length > 0 || i.organizationId).map((i) => ({
...i,
platform: i.platform,
url: i.url,
name: i.name,
Expand Down

0 comments on commit 372d2f2

Please sign in to comment.