Skip to content

Commit

Permalink
pass context to patient data for use in string lookups, fix null obje…
Browse files Browse the repository at this point in the history
…ct reference
  • Loading branch information
slogan621 committed Mar 23, 2021
1 parent 39551dc commit 8fcee3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ public int fromJSONObject(JSONObject o)
return ret;
}

public JSONObject toJSONObject()
public JSONObject toJSONObject(Context ctx)
{
JSONObject data = new JSONObject();
try {
Expand All @@ -567,7 +567,7 @@ public JSONObject toJSONObject()
data.put("maternal_last", getMotherLast());
data.put("first", getFirst());
data.put("middle", getMiddle());
data.put("dob", fromDobMilitary(null, getDob()));
data.put("dob", fromDobMilitary(ctx, getDob()));
data.put("gender", getGender());
data.put("street1", getStreet1());
data.put("street2", getStreet2());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public Object createPatient(PatientData pd) {

RequestQueue queue = volley.getQueue();

JSONObject data = pd.toJSONObject();
JSONObject data = pd.toJSONObject(getContext());

String url = String.format("%s://%s:%s/tscharts/v1/patient/", getProtocol(), getIP(), getPort());

Expand Down Expand Up @@ -363,15 +363,15 @@ public Object findPatientsByNameAndClinicId(String name, int clinicId, int categ
return m_lock;
}

public Object updatePatient(PatientData pd) {
public Object updatePatient(Context ctx, PatientData pd) {

VolleySingleton volley = VolleySingleton.getInstance();

volley.initQueueIf(getContext());

RequestQueue queue = volley.getQueue();

JSONObject data = pd.toJSONObject();
JSONObject data = pd.toJSONObject(ctx);

String url = String.format("%s://%s:%s/tscharts/v1/patient/%d/", getProtocol(), getIP(), getPort(), pd.getId());

Expand Down

0 comments on commit 8fcee3c

Please sign in to comment.