Skip to content

Commit f882c03

Browse files
authored
Merge pull request #944 from hmcts/fix-active-aplsubmitted-paymentstatus
Fix for ticket 1911. ref_txn_df1 was referencing wrong table. values …
2 parents b099afa + 9576b29 commit f882c03

3 files changed

Lines changed: 29 additions & 10 deletions

File tree

Databricks/ACTIVE/APPEALS/GOLD_APPEAL_SUBMITTED_JSON.ipynb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,11 @@
218218
"cell_type": "markdown",
219219
"metadata": {
220220
"application/vnd.databricks.v1+cell": {
221-
"cellMetadata": {},
221+
"cellMetadata": {
222+
"batchId": -6018114963734290,
223+
"byteLimit": 2048000,
224+
"rowLimit": 10000
225+
},
222226
"inputWidgets": {},
223227
"nuid": "e818dd62-dc2f-4b3b-bac0-f9216f747357",
224228
"showTitle": false,
@@ -407,14 +411,21 @@
407411
"inputWidgets": {},
408412
"nuid": "3c102932-86cd-491c-ba77-39fc6a8d92e9",
409413
"showTitle": true,
410-
"tableResultSettingsMap": {},
414+
"tableResultSettingsMap": {
415+
"0": {
416+
"dataGridStateBlob": "{\"version\":1,\"tableState\":{\"columnPinning\":{\"left\":[\"#row_number#\"],\"right\":[]},\"columnSizing\":{},\"columnVisibility\":{}},\"settings\":{\"columns\":{}},\"syncTimestamp\":1775056717427}",
417+
"filterBlob": "{\"version\":1,\"filterGroups\":[],\"syncTimestamp\":1775051018238}",
418+
"queryPlanFiltersBlob": "[]",
419+
"tableResultIndex": 0
420+
}
421+
},
411422
"title": "Function: paymentType"
412423
}
413424
},
414425
"outputs": [],
415426
"source": [
416427
"df, df_audit = APS.paymentType(silver_m1, silver_m4)\n",
417-
"# display(df)"
428+
"# df.display()"
418429
]
419430
},
420431
{

Databricks/ACTIVE/APPEALS/shared_functions/appealSubmitted.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def paymentType(silver_m1, silver_m4):
6060

6161
ref_txn_df1 = (
6262
silver_m4.alias("m4")
63-
.join(ref_txn_df.alias("ref_txn"), col("m4.TransactionId") == col("ref_txn.ReferringTransactionId"), "left_anti")
63+
.join(ref_txn_df1.alias("ref_txn"), col("m4.TransactionId") == col("ref_txn.ReferringTransactionId"), "left_anti")
6464
.select("CaseNo", "TransactionId", "TransactionTypeId", "Amount", "SumBalance", "SumTotalPay")
6565
)
6666

@@ -160,7 +160,7 @@ def paymentType(silver_m1, silver_m4):
160160
.otherwise(lit(None))
161161
.alias("dv_paymentStatus"),
162162
)
163-
.select(
163+
.select(
164164
"CaseNo",
165165
"feeAmountGbp",
166166
"feeDescription",
@@ -177,9 +177,10 @@ def paymentType(silver_m1, silver_m4):
177177
"rpDcAppealHearingOption",
178178
"paidDate",
179179
"paidAmount",
180-
"additionalPaymentInfo",
180+
"additionalPaymentInfo"
181181
)
182182
)
183+
183184
payment_audit_final = (
184185
payment_audit.alias("audit")
185186
.join(paid_amount.alias("paid_amount"), ["CaseNo"], "left")

tests/active/appealSubmitted/aps_paymentType_test.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,18 @@ def test_paymentStatus(self, spark):
106106

107107
resultList = df.orderBy(col("CaseNo").cast("int")).select("paymentStatus").collect()
108108

109-
assert resultList[0][0] == "Paid" and resultList[1][0] == "Paid" and resultList[2][0] == "Paid" and resultList[3][0] == "Paid"
109+
assert resultList[0][0] == "Paid"
110+
assert resultList[1][0] == "Paid"
111+
assert resultList[2][0] == "Paid"
112+
assert resultList[3][0] == "Paid"
110113
assert resultList[4][0] is None
111-
assert resultList[5][0] == "Paid" and resultList[6][0] == "Paid" and resultList[7][0] == "Paid"
112-
assert resultList[8][0] == "Paid" and resultList[9][0] == "Payment pending"
113-
assert resultList[10][0] == "Paid" and resultList[11][0] == 'Payment pending' #ignore TransactionTypeId == 6, 19
114+
assert resultList[5][0] == "Paid"
115+
assert resultList[6][0] == "Paid"
116+
assert resultList[7][0] == "Paid"
117+
assert resultList[8][0] == "Payment pending"
118+
assert resultList[9][0] == "Payment pending"
119+
assert resultList[10][0] == "Paid"
120+
assert resultList[11][0] == 'Paid' #ignore TransactionTypeId == 6, 19
114121

115122
def test_paAppealTypePaymentOption(self, spark):
116123
with patch('Databricks.ACTIVE.APPEALS.shared_functions.appealSubmitted.PP') as PP:

0 commit comments

Comments
 (0)