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

fix: remove usage of probability field #5877

Merged
merged 6 commits into from
Jul 16, 2024

Conversation

siiddhantt
Copy link
Contributor

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

  • Removed 'probability' field from filter definitions and related utilities
  • Eliminated 'probability' field from GraphQL queries and mock data
  • Updated type definitions and validation logic to exclude 'probability' field
  • Removed 'probability' field from database seed data and workspace migrations
  • Adjusted test cases to no longer include 'probability' field

@lucasbordeau
Copy link
Contributor

@Bonapara Should we remove the entire probability type from Twenty or just this particular field on opportunity ?

@Bonapara
Copy link
Member

@lucasbordeau we should keep the Rating field type but remove this probability field from the opportunity object.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Commented out FieldMetadataType.Probability in SettingsObjectNewFieldStep2.tsx
  • Added PROBABILITY field type handling as number in computeInputFields.ts
  • Added PROBABILITY to FieldMetadataType enum in data.types.ts

@siiddhantt
Copy link
Contributor Author

hi!
made changes so the probability field is only removed from the front and server in opportunity, and also the rating field is already present there

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Removed usage of the probability field
  • Deleted imports and logic for isFieldRating and isFieldRatingValue
  • Updated field validation and persistence logic

@lucasbordeau lucasbordeau self-assigned this Jun 21, 2024
@lucasbordeau
Copy link
Contributor

@siiddhantt Hi, please could you keep everything related to this field type, we don't want to remove the probability field type, which is a backend metadata feature level, we just want to remove a particular standard field which is on the standard seed data level.

I'll explain in more details what we want here :

  • Keep everything related to field types rating and probability
  • Remove this field from the seeds of standard field we have in the code, so it doesn't get created on new Twenty installations
  • Propose a way to migrate properly this field if it already exists in a workspace to a custom field, so it will be the same for users who use this field, except this field will turn into a custom field.

For the migration, you might want to test it on your local install, and we will test it on our side before running it for all workspaces.

This is a bit complex, don't hesitate to ask for more details and you can reach us on our Discord also.

@charlesBochet
Copy link
Member

@siiddhantt @lucasbordeau Taking a look at this one:

As Lucas said there are different aspects in this work:

  • Field types: we should keep RATING type and remove PROBABILITY type which is not used actually.
  • Deprecate Field probability on opportunity: we actually don't want to remove it (as users could have data stored in it) but deprecate it. This is quite complex and @ijreilly will be leading the effort here next week. We can remove seeding logic though

Could you restrict the scope of this PR to removing PROBABILITY field type + stop seeding opportunity probability field?
I'm adding specific comments on the PR to guide you

@@ -29,11 +29,6 @@ export const formatFieldMetadataItemsAsFilterDefinitions = ({
return acc;
}

// Todo: remove once Rating fieldtype is implemented
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine as we will deprecate the field, let's keep it

@@ -466,23 +466,6 @@ export const getObjectMetadataItemsMock = () => {
fromRelationMetadata: null,
toRelationMetadata: null,
},
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok :)

@@ -5517,29 +5517,6 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
"toRelationMetadata": null
}
},
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -166,7 +166,7 @@ export const SettingsObjectNewFieldStep2 = () => {
// FieldMetadataType.FullName,
// FieldMetadataType.Link,
FieldMetadataType.Numeric,
FieldMetadataType.Probability,
// FieldMetadataType.Probability,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -142,14 +142,6 @@ export const mockedViewFieldsData = [
isVisible: true,
size: 180,
},
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -25,7 +25,6 @@ export const seedOpportunity = async (
'amountAmountMicros',
'amountCurrencyCode',
'closeDate',
'probability',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep it for now

@@ -145,13 +145,6 @@ const fieldNumericMock = {
defaultValue: null,
};

const fieldProbabilityMock = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Exclude 'probability' field from filter definitions
  • Add support for 'Rating' field type in usePersistField
  • Reintroduce 'probability' field in opportunity seed data with default value 0.5

3 file(s) reviewed, no comment(s)

@FelixMalfait
Copy link
Member

FelixMalfait commented Jul 11, 2024

cc @ijreilly could you please take over this PR as it's related to yours?

Also fyi #3531 we do want to remove the probability field type so this PR might get us there.

We have the rating field type which is good enough to represent this. Eventually at some point we'll have display options on the rating field type "stars, progress bar, etc."

Thanks @siiddhantt for the contribution!

@ijreilly
Copy link
Collaborator

Hi @siiddhantt, thank you for your contribution!
In a different PR we have removed the usage of Probability field on object Opportunity. This was part of a recent effort to ease standard field deprecation.
If you are still keen to work on the removal of probability field, I think you can merge main and solve the conflicts, then I think we should be good or close! Otherwise I can take over the work, let me know :)

@siiddhantt
Copy link
Contributor Author

Hi @ijreilly thanks for the update! I appreciate your help on this.
Since you've been working on a related issue, you could take over this. Thanks :)

@ijreilly
Copy link
Collaborator

Got it, @siiddhantt thanks a lot for your contribution and interest in twenty!

@ijreilly ijreilly merged commit 364caf0 into twentyhq:main Jul 16, 2024
12 checks passed
@ijreilly
Copy link
Collaborator

Closes #6259

Copy link

Thanks @siiddhantt for your contribution!
This marks your 0th PR on the repo. You're top 0% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Timebox] Remove "Probability" Field from Opportunities
6 participants