Skip to content

BE-DP-24 · The money study's follow-up: paid bills with no instalment, and what debts and letters point at

ID BE-DP-24 · Level L0 · Pack Pack R2 · The money study · Run order row 2, after BE-DP-18 and BE-DP-19 · Issue #185

The counts are on #185 for the four things BE-DP-18 and BE-DP-19 left unexplained (the study's report), so the money step can be written:

  • 8 · The bills with no instalment: 17,169 bills, 17,129 of them Lunas with dibayar covering the total. Their kinds and statuses, the months they were made, the forms of their source key, and whether v1's payments table or the bill's own bukti_bayar holds their money. This is the evidence for #293.
  • 9 · The 8 instalments whose amount isn't above zero: zero, below zero or not a number, and whether they were voided. A v2 payment's amount must be above zero.
  • 10 · What debts and claim letters point at: debts.data.ref (a-a:9, 624 debts) names no bill, and only 23 of the letters' 1,347 debtIds name a debt. This block prints the code before the ref's colon, then tries the ref's number and every debtId against every v1 table's id and data.id.
  • 11 · The 26 claim letter numbers used more than once: whether each repeat is the same letter twice (same driver, date and total) or a different letter under the same number. A v2 debt letter's number is unique (debt_letters_number_unique).

tools/migration/v1-copy/money-followup.sql prints counts, sums over five bills or more, forms (a-a:9), and the ref's code when it is letters only (such as OR-KLAIM). It never prints a name, a plate, a file name or one driver's amount (D15). It reads the copy and changes nothing in it.

  • BE-DP-18 and BE-DP-19 are logged on #185.
  • docker ps --filter name=v1copy lists the copy as Up.
  • You are at the root of your clone, on main once this step's pull request is merged.
Terminal window
docker exec -i v1copy psql -qX -U postgres -d postgres < tools/migration/v1-copy/money-followup.sql

Eight tables, in a minute or two, headed 8a to 8c, 9, 10a and 10b, and two under 11.

  • 8a: its bills add up to 17,169, BE-DP-18's bills with no instalment. Expect most in Adm. Pendaftaran, Lunas.
  • 9: at most 8 lines' worth of instalments, BE-DP-18's 8.
  • 10a: a few codes at most, with debts adding up to near 626, the debts with a ref.
  • 10b: one line per pair of a source and a target where something matched. Small numbers match many tables by chance, so the line to look for is a target whose matched is close to distinct_values. A source with an empty target matched nothing anywhere.
  • 11: numbers adds up to 26.

Read 8c and 10a before posting. 8c's forms should be letters and digits only (a 9). 10a's codes should read like a kind of record (OR-KLAIM, ETLE). If either shows a name or a number as it is, delete that line and say you did.

Then post the tables on #185, as printed. Post 8a to 8c on #293 too.

  • ERROR: invalid input syntax for type boolean: a manual, edited or voided key holds something other than true or false. Post the line; it names the type, not the value.
  • It runs for more than ten minutes: 10b reads every table once. Let it finish. If it seems stuck, docker exec v1copy psql -U postgres -c "select now() - query_start, left(query, 60) from pg_stat_activity where state = 'active'" shows how long it has run.
  • Anything else: post the ERROR line on #185.

Nothing to undo: it reads only, and its tables and functions are temporary.

Log each run as a comment on #185: date · who · result, with the tables.