-
Notifications
You must be signed in to change notification settings - Fork 27
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
#3015 fix insurance policy outgoing sync formatting #3030
#3015 fix insurance policy outgoing sync formatting #3030
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im confused a little bit soz!
@@ -2,7 +2,8 @@ import Realm from 'realm'; | |||
|
|||
export class InsurancePolicy extends Realm.Object { | |||
get policyNumber() { | |||
return `${this.policyNumberPerson} ${this.policyNumberFamily}`; | |||
if (!this.policyNumberPerson) return this.policyNumberFamily; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both values are required in the schema aren't they?
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I believe that just means it can't be set to null
or undefined
? As it's a primitive I think it makes more sense to have it initialised to a falsey but non-null value?
To make it more explicit can do:
policyNumberPerson: { type: 'string', default: '' };
but I think the above is equivalent to the existing declaration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know so I did a quick test with:
UIDatabase.write(() => {
const insuranceProvider = UIDatabase.update('InsuranceProvider', {
id: '1',
});
UIDatabase.update('InsurancePolicy', { id: '1', insuranceProvider });
});
And got the error "Missing value for property InsurancePolicy.policyNumberFamily
" - so I believe you need to explicitly set the default. Also doesn't say anything in the docs about defaults being set for primitives automatically: https://realm.io/docs/javascript/latest/#default-property-values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #3015.
Change summary
Fixes formatting of policy numbers synced from mobile to desktop.
Testing
Steps to reproduce or otherwise test the changes of this PR:
familyNumber-personalNumber
).familyNumber
).Related areas to think about
N/A.