Issues fixed:
Updater script had wrong file path.
Tare/gross timestamps confusingly out of order (labelled correct though).
Joined output would truncate last gross weight if there was an odd number of entries
This commit is contained in:
Thaddeus Hughes
2025-10-09 08:08:09 -05:00
parent bb5536614b
commit deea966f6c
12 changed files with 5398 additions and 5384 deletions

View File

@@ -1,4 +1,5 @@
GROSS_WT,TARE_WT,NET_WT,TARE_T,GROSS_T,GROSS_UNITS,TARE_UNITS,NET_UNITS
0,3780,-3780,09/17/2025 06:13 PM,09/17/2025 06:12 PM,lb,lb,lb
3780,3640,140,09/17/2025 10:19 PM,09/17/2025 10:18 PM,lb,lb,lb
1640,0,1640,09/17/2025 10:20 PM,09/17/2025 10:19 PM,lb,lb,lb
GROSS_WT,TARE_WT,NET_WT,GROSS_T,TARE_T,GROSS_UNITS,TARE_UNITS,NET_UNITS
0,3780,-3780,09/17/2025 06:12 PM,09/17/2025 06:13 PM,lb,lb,lb
3780,3640,140,09/17/2025 10:18 PM,09/17/2025 10:19 PM,lb,lb,lb
1640,0,1640,09/17/2025 10:19 PM,09/17/2025 10:20 PM,lb,lb,lb
1680,,,09/17/2025 10:19 PM,,lb,,
1 GROSS_WT TARE_WT NET_WT GROSS_T TARE_T GROSS_UNITS TARE_UNITS NET_UNITS
2 0 3780 -3780 09/17/2025 06:12 PM 09/17/2025 06:13 PM lb lb lb
3 3780 3640 140 09/17/2025 10:18 PM 09/17/2025 10:19 PM lb lb lb
4 1640 0 1640 09/17/2025 10:19 PM 09/17/2025 10:20 PM lb lb lb
5 1680 09/17/2025 10:19 PM lb

View File

@@ -5,3 +5,4 @@ WEIGHT,UNITS,TIME
3640,lb,09/17/2025 10:19 PM
1640,lb,09/17/2025 10:19 PM
0,lb,09/17/2025 10:20 PM
1680,lb,09/17/2025 10:19 PM
1 WEIGHT UNITS TIME
5 3640 lb 09/17/2025 10:19 PM
6 1640 lb 09/17/2025 10:19 PM
7 0 lb 09/17/2025 10:20 PM
8 1680 lb 09/17/2025 10:19 PM

View File

@@ -16,3 +16,6 @@ GROSS 1640 lb
GROSS 00 lb
10:20 PM 09/17/25
GROSS 1680 lb
10:19 PM 09/17/25

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -62,7 +62,7 @@
[],
False,
False,
1758200623,
1760015187,
[('runw.exe',
'C:\\Users\\Thad\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\runw.exe',
'EXECUTABLE')],

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/main/main.exe vendored

Binary file not shown.

17
main.py
View File

@@ -33,6 +33,7 @@ def parse_logs(log_text):
dt = datetime.strptime(ts_line, '%I:%M %p %m/%d/%y')
excel_ts = dt.strftime('%m/%d/%Y %I:%M %p')
pairs.append((weight, units, excel_ts))
print((weight, units, excel_ts))
except ValueError:
i += 1
continue
@@ -54,19 +55,27 @@ def write_csv1(pairs, filename):
def write_csv2(pairs, filename):
with open(filename, 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['GROSS_WT', 'TARE_WT', 'NET_WT', 'TARE_T', 'GROSS_T', 'GROSS_UNITS', 'TARE_UNITS', 'NET_UNITS'])
writer.writerow(['GROSS_WT', 'TARE_WT', 'NET_WT', 'GROSS_T', 'TARE_T', 'GROSS_UNITS', 'TARE_UNITS', 'NET_UNITS'])
for j in range(0, len(pairs), 2):
if j + 1 < len(pairs):
gross_weight, gross_units, gross_time = pairs[j]
tare_weight, tare_units, tare_time = pairs[j + 1]
net = gross_weight - tare_weight
# Use gross units for net (assuming consistent units within pairs)
writer.writerow([gross_weight, tare_weight, net, tare_time, gross_time, gross_units, tare_units, gross_units])
net_units = tare_units
if (tare_units != gross_units):
net_units = 'MISMATCH'
net = 'UNIT MISMATCH'
writer.writerow([gross_weight, tare_weight, net, gross_time, tare_time, gross_units, tare_units, net_units])
if (len(pairs) % 2): # if odd number of items
gross_weight, gross_units, gross_time = pairs[-1]
writer.writerow([gross_weight, '', '', gross_time, '', gross_units, '', ''])
def run_update_script():
try:
# Run update.sh script
result = subprocess.run(['sh', 'C:\\Program Files\\rslugger-merger\\update.sh'], capture_output=True, text=True, cwd=os.getcwd())
result = subprocess.run(['sh', 'C:\\Program Files\\rslogger-merger\\update.sh'], capture_output=True, text=True, cwd=os.getcwd())
if result.returncode == 0:
messagebox.showinfo("Success", f"update.sh executed successfully!\n\nOutput:\n{result.stdout}")
else: