Skip to content

Commit

Permalink
optimizing the fix for #45
Browse files Browse the repository at this point in the history
Require Patch to MySQL:
ALTER TABLE `raw_` ADD COLUMN `synced` TINYINT(2) NULL DEFAULT '0' AFTER `last_edited`;
  • Loading branch information
Mathew authored and Mathew committed Aug 12, 2021
1 parent 118f01a commit 19b7dda
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ public static void sendDataX_a(String stt, String prnt, String numz) throws Clas

try {

ps = conn.prepareStatement("select name, uuid, idx, rec_created, level from raw_ where level = ? and path_parent like '%" + prnt + "%'");
ps = conn.prepareStatement("select name, uuid, idx, rec_created, level, code from raw_ where level = ? and path_parent like '%" + prnt + "%'");
ps.setString(1, numz);
rx = ps.executeQuery();

Expand All @@ -945,17 +945,17 @@ public static void sendDataX_a(String stt, String prnt, String numz) throws Clas
int vk = 1;

if ("2".equals(rx.getString(5))) {
dxs = "insert into region (uuid,name,externalid,id,changedate,creationdate) values(?,?,?,?,now(),?) ON CONFLICT DO NOTHING";
dxs = "insert into region (uuid,name,externalid,id,changedate,creationdate,epidcode) values(?,?,?,?,now(),?,?) ON CONFLICT DO NOTHING";
re_g++;
} else if ("3".equals(rx.getString(5))) {
ds_c++;
dxs = "insert into district (uuid,name,externalid,id,changedate,creationdate,region_id) values(?,?,?,?,now(),?,'" + stt + "') ON CONFLICT DO NOTHING";
dxs = "insert into district (uuid,name,externalid,id,changedate,creationdate,region_id,epidcode) values(?,?,?,?,now(),?,'" + stt + "',?) ON CONFLICT DO NOTHING";
} else if ("4".equals(rx.getString(5))) {
com_m++;
dxs = "insert into community (uuid,name,externalid,id,changedate,creationdate, district_id) values(?,?,?,?,now(),?,'" + stt + "') ON CONFLICT DO NOTHING";
dxs = "insert into community (uuid,name,externalid,id,changedate,creationdate, district_id,epidcode) values(?,?,?,?,now(),?,'" + stt + "',?) ON CONFLICT DO NOTHING";
} else if ("5".equals(rx.getString(5))) {
fac_l++;
dxs = "insert into facility (uuid,name,externalid,id,changedate,creationdate, community_id) values(?,?,?,?,now(),?,'" + stt + "') ON CONFLICT DO NOTHING";
dxs = "insert into facility (uuid,name,externalid,id,changedate,creationdate, community_id,epidcode) values(?,?,?,?,now(),?,'" + stt + "',?) ON CONFLICT DO NOTHING";
} else if ("1".equals(rx.getString(5))) {
vk = 0;
}
Expand All @@ -966,6 +966,7 @@ public static void sendDataX_a(String stt, String prnt, String numz) throws Clas
ps_pg.setString(3, rx.getString(2));
ps_pg.setInt(4, rx.getInt(3));
ps_pg.setDate(5, rx.getDate(4));
ps_pg.setString(6, rx.getString(6));

// System.out.println(ps_pg);
ret = ps_pg.executeUpdate();
Expand Down
12 changes: 7 additions & 5 deletions sormas_HL7v2/src/main/webapp/fhir_frontend/OrgToolOperation.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@



<a onclick="start_pushX_X()" id="send_all_availx" class="btn btn-app hvr-icon-buzz-out">
<a onclick="start_pushX_X_x()" id="send_all_availx" class="btn btn-app hvr-icon-buzz-out">
<i class="fas fa-play hvr-icon"></i> Sync with NEW SORMAS
</a>

Expand Down Expand Up @@ -645,6 +645,8 @@
};
xhr.send(null);
success: servlet_primer(stat - 1);
// setTimeout($('#progress_x').hide();, 2000)
}
}
Expand All @@ -658,8 +660,8 @@
document.getElementById("pbar").style.width = width + '%';
document.getElementById("chunker").innerHTML = 'Total chunks remaining = ' + width;
document.getElementById("chunker_").innerHTML = 'Total chunks remaining = ' + width;
//document.getElementById("chunker_").innerHTML = maz;
if (width < 3) {
document.getElementById("chunker_").innerHTML = maz;
if (width === 0) {
//Fhir need to start here.
$('#progress_').hide();
Expand Down Expand Up @@ -1805,7 +1807,7 @@
}
;
function start_pushX_X() {
function start_pushX_X_x() {
document.getElementById("overlay").style.display = "block";
$('#text').html("Pushing all available matched data to sormas...");
var xhr = new XMLHttpRequest();
Expand All @@ -1818,7 +1820,7 @@
document.getElementById("overlay").style.display = "none";
alertx(xhr.responseText);
//alertx(xhr.responseText);
}
}
Expand Down

0 comments on commit 19b7dda

Please sign in to comment.