Proper Implementation of synced flag in Patient.java

I stumbled upon this function ie isSynced() inside patient.java file , but I couldnt understand how this synced flag works since I couldnt find any proper synced attribute inside the class. I could find this PR which introduced this but really couldnt gather much from the conversation. please help!!

@avijitghosh82 @f4ww4z @raff

@saurabh I think inside that isSynced() function, you should check if all the patient attributes are up to date with the server’s. It should be asynchronous function since you’d need to connect first.

But I’d rather wait until Patient.java is converted to kotlin, there’s an open PR for this.

@f4ww4z cant we make a boolean attribute which we would set and unset while registering and updating patients and just return that attribute in this function?? Becasue I could not find any such field in these related POJOs to patient .

@saurabh That shouldn’t be necessary. We should refactor this isSynced function somewhere else such that its nature is asynchronous. See the syncPatient function in PatientRepository.java.

I will look into that thank you @f4ww4z !!