Work on better partials matching.

This commit is contained in:
Dominik Pantůček 2023-07-29 15:51:15 +02:00
parent 9ca16fe6c5
commit ec804535c0
2 changed files with 9 additions and 6 deletions

View file

@ -25,6 +25,9 @@
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# #
# Not usable anymore, kept for reference
exit 0
# REST API endpoint # REST API endpoint
APIURI=https://www.fio.cz/ib_api/rest APIURI=https://www.fio.cz/ib_api/rest
@ -219,7 +222,7 @@ get_header_field() {
# $1 - account number # $1 - account number
make_acc_header() { make_acc_header() {
first="`first_acc_part $1`" first="`first_acc_part $1`"
last="`last_acc_part $2`" last="`last_acc_part $1`"
firstfname="$BANK_DIR_PARTS/$first" firstfname="$BANK_DIR_PARTS/$first"
lastfname="$BANK_DIR_PARTS/$last" lastfname="$BANK_DIR_PARTS/$last"
make_acc_header_static "$firstfname" make_acc_header_static "$firstfname"

View file

@ -236,7 +236,7 @@ first_acc_part() {
accno="$1" accno="$1"
ls "${BANK_DIR_PARTS}/" \ ls "${BANK_DIR_PARTS}/" \
| grep "^$accno" \ | grep "^$accno" \
| grep '.csv$' \ | grep '[-][0-9][0-9][0-9][0-9].csv$' \
| sort \ | sort \
| head -n 1 | head -n 1
} }
@ -248,7 +248,7 @@ last_acc_part() {
accno="$1" accno="$1"
ls "${BANK_DIR_PARTS}/" \ ls "${BANK_DIR_PARTS}/" \
| grep "^$accno" \ | grep "^$accno" \
| grep '.csv$' \ | grep '[-][0-9][0-9][0-9][0-9].csv$' \
| sort -r \ | sort -r \
| head -n 1 | head -n 1
} }
@ -261,7 +261,7 @@ all_but_first_parts() {
first="`first_acc_part $1`" first="`first_acc_part $1`"
ls "${BANK_DIR_PARTS}/" \ ls "${BANK_DIR_PARTS}/" \
| grep "^$accno" \ | grep "^$accno" \
| grep '.csv$' \ | grep '[-][0-9][0-9][0-9][0-9].csv$' \
| sort \ | sort \
| grep -v "$first" | grep -v "$first"
} }
@ -288,7 +288,7 @@ get_header_field() {
# $1 - account number # $1 - account number
make_acc_header() { make_acc_header() {
first="`first_acc_part $1`" first="`first_acc_part $1`"
last="`last_acc_part $2`" last="`last_acc_part $1`"
firstfname="$BANK_DIR_PARTS/$first" firstfname="$BANK_DIR_PARTS/$first"
lastfname="$BANK_DIR_PARTS/$last" lastfname="$BANK_DIR_PARTS/$last"
make_acc_header_static "$firstfname" make_acc_header_static "$firstfname"
@ -301,7 +301,7 @@ make_acc_header() {
} }
# #
# Creates the complete merged account statement # Creates the complete merged account statement from yearly partials
# $1 - account number # $1 - account number
merge_acc() { merge_acc() {
make_acc_header "$1" make_acc_header "$1"