Sync request Comes with duration, but without duration unit
Posted: Fri Nov 25, 2022 12:40 pm
by tornikezhizh
Hello, I have weird scenario there, when I update endTime or StartTime, sync request acts very weird, sometimes it passes both start and end date/time, sometimes only one of them and + automatically calculated duration, but duration unit never passed to request, and as far as I understand, sometimes it comes in hours, like when difference between start time and end time is 30 minutes, duration is 0.5, but if difference is 38 minutes, duration is 0.02638888888888889M, which is not in hours, but in days and I can't apply correct logic, since I don't receive duration unit. What will be best solution in case like this?
Re: Sync request Comes with duration, but without duration unit
Posted: Fri Nov 25, 2022 2:57 pm
by johan.isaksson
Hello,
On sync, only the changes are sent by default. Duration will be in the unit it was loaded in, if the unit had changed too it would be part of the sync. So the duration you received is in the unit that was sent in the load, or in the default duration unit if it is a new event record.
class Person extends Model {
static get fields() {
return [
'name',
{ name : 'birthday', type : 'date', format : 'YYYY-MM-DD', alwaysWrite : true },
{ name : 'shoeSize', type : 'number', defaultValue : 11 },
{ name : 'age', readOnly : true }
];
}
}
Re: Sync request Comes with duration, but without duration unit