-
Notifications
You must be signed in to change notification settings - Fork 50
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
refactor: refactor formatting of data before sending to the backend #864
base: master
Are you sure you want to change the base?
Conversation
return { | ||
restriction_type: null, | ||
countries: null, | ||
states: null, | ||
restriction_type: courseData.location_restriction?.restriction_type || null, | ||
countries: courseData.location_restriction?.countries || [], | ||
states: courseData.location_restriction?.states || [], | ||
}; | ||
} | ||
|
||
formatGeoLocationFields(courseData) { | ||
if (courseData?.geolocation) { | ||
return { | ||
geoLocationName: courseData.geolocation.location_name, | ||
geoLocationLng: courseData.geolocation.lng, | ||
geoLocationLat: courseData.geolocation.lat, | ||
}; | ||
} | ||
return { | ||
geoLocationName: null, | ||
geoLocationLng: null, | ||
geoLocationLat: null, | ||
geoLocationName: courseData.geolocation?.location_name || '', | ||
geoLocationLng: courseData.geolocation?.lng || null, | ||
geoLocationLat: courseData.geolocation?.lat || null, |
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.
This is backend data rendering on publisher. Are you sure it is working as expected, like adding [] for fields?
if (fact_1.heading && fact_2.heading) { | ||
return [ | ||
fact_1, fact_2, | ||
]; | ||
} | ||
if (fact_1.heading) { | ||
return [fact_1]; | ||
} | ||
if (fact_2.heading) { | ||
return [fact_2]; | ||
} | ||
return []; | ||
} |
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.
Either both facts should be there or none. Only one fact is not allowed.
PROD-3202
Description
In this PR, we make some changes to the formatting of data before sending it to the backend. This is done so as to ensure that the backend receives data in the format that it is expecting. This is required to enable the backend to decide whether the incoming data is different than the one present in the database or are there any real changes?