Skip to content
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

[bot] Merge 23.11 to 24.2 #516

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ private void organizeOnCallEvents(JSONObject[][] onCallSchedule, JSONArray event
String description = event.getString("description") != null ? event.getString("description") : "NO PHONE NUMBER";
description = description.replaceAll("(?i)<br */?>", "\n").trim();
description = Jsoup.parse(description).wholeText().replaceAll("\\R", "<br>");
if (onCallSchedule[i + 1][column].getString("html") == null) {
if (onCallSchedule[i + 1][column].isEmpty() || onCallSchedule[i + 1][column].getString("html") == null) {
onCallSchedule[i + 1][column].put("html", "<strong>" + title + "<br>" + description + "</strong>");
} else {
onCallSchedule[i + 1][column].put("html", "<strong>" + onCallSchedule[i + 1][column].getString("html") + "<br>" + title + "<br>" + description + "</strong>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public String getWeightFromAnimalID(Container currentContainer, User currentUser
* 2. "No animal replacement fee to be paid (causeOfDeath death)".
* 3. "".
*/
public String getAnimalReplacementFee(Container currentContainer, User currentUser, String causeOfDeath) {
public String getAnimalReplacementFee(Container currentContainer, User currentUser, String causeOfDeath, String animalID) {
//Sets up variables.
StringBuilder returnFee = new StringBuilder();
SimpleFilter queryFilter = new SimpleFilter(FieldKey.fromString("Value"), causeOfDeath, CompareType.EQUAL);
Expand All @@ -384,7 +384,32 @@ public void exec(ResultSet rs) throws SQLException {
//Returns fee.
//TODO: Ask Daniel if this an empty fee (instead of 'fee' or 'no fee') should be 'no fee'.
if (returnFee.toString().equals("Fee")) {
return ("Animal replacement fee to be paid (" + causeOfDeath + " death)");


//TODO: Added this for hotfix, clean up later.
SimpleFilter feeFilter = new SimpleFilter("id", animalID, CompareType.EQUAL);
TableSelector feeTable = new TableSelector(QueryService.get().getUserSchema(currentUser, currentContainer, "study").getTable("demographics"), feeFilter, null);
//Gets fee from table.
StringBuilder updatedFee = new StringBuilder();
if (feeTable != null) {
if (feeTable.getRowCount() > 0) {
myTable.forEach(new Selector.ForEachBlock<ResultSet>() {
@Override
public void exec(ResultSet rs) throws SQLException {
updatedFee.append(rs.getString("prepaid"));
}
});
}
}
if (!updatedFee.isEmpty()) {
return updatedFee.toString();
}
else {
return ("Animal replacement fee to be paid (" + causeOfDeath + " death)");
}
//TODO: End of hotfix changes.


}
else if (returnFee.toString().equals("No Fee")) {
return ("No animal replacement fee to be paid (" + causeOfDeath + " death)");
Expand Down Expand Up @@ -554,7 +579,7 @@ public DeathNecropsyObject(Container c, User u, String animalID, String hostName
//Gets animal replacement fee.
//TODO: What should I return when this is null? Currently I just have it return a blank string.
if (necropsyTypeOfDeath != null) {
this.animalReplacementFee = notificationToolkit.getAnimalReplacementFee(c, u, this.necropsyTypeOfDeath);
this.animalReplacementFee = notificationToolkit.getAnimalReplacementFee(c, u, this.necropsyTypeOfDeath, animalID);
}

//Creates task id with hyperlink.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,18 @@
List<JSONObject> preDeathTissueSamples = JsonUtils.getSortedListFromJSONArray(queryFactory.selectRows("study", "tissue_samples", preDeathFilter), "collection_order");

for (JSONObject tissueSample : preDeathTissueSamples) {

String deliveryMethod = tissueSample.getString("ship_to");
if (deliveryMethod != null) {
String deliveryMethod;
try{
deliveryMethod = tissueSample.getString("ship_to");
}catch(Exception JSONException){
deliveryMethod = null;
}
if (deliveryMethod != null)
{
NecropsySampleDeliveryDestination.SampleDeliveryDestination deliveryDestination = NecropsySampleDeliveryDestination.SampleDeliveryDestination.valueOf(deliveryMethod);

if (deliveryDestination != null) {
if (deliveryDestination != null)
{
deliveryMethod = deliveryDestination.getTitle();
}
}
Expand Down Expand Up @@ -210,8 +216,12 @@
List<JSONObject> postmortemTissueSamples = JsonUtils.getSortedListFromJSONArray(queryFactory.selectRows("study", "tissue_samples", preDeathFilter), new NumberKeyComparator("collection_order"));

for (JSONObject tissueSample : postmortemTissueSamples) {

String deliveryMethod = tissueSample.getString("ship_to");
String deliveryMethod;
try{
deliveryMethod = tissueSample.getString("ship_to");
}catch(Exception JSONException){
deliveryMethod = null;
}
if (deliveryMethod != null) {
NecropsySampleDeliveryDestination.SampleDeliveryDestination deliveryDestination = NecropsySampleDeliveryDestination.SampleDeliveryDestination.valueOf(deliveryMethod);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@
JSONArray weights = queryFactory.selectRows("study", "weight", taskFilter);
List<String> weightList = new ArrayList();
for (JSONObject weightRecord : JsonUtil.toJSONObjectList(weights)) {
String weight = weightRecord.getString("weight");
String weight;
try{
weight = weightRecord.getString("weight");

}catch(Exception JSONException){
weight = null;
}
if (weight == null) {
weight = "[not specified]";
}
Expand Down
Loading