|
@@ -1,6 +1,10 @@
|
|
|
#! /usr/bin/env python3
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
+# Moulinette permettant de produire des relevés de comptes mensuels
|
|
|
+# au format CSV à partir d'exports CSV venant de l'interface Web du
|
|
|
+# crédit coopératif et ayant des chevauchements.
|
|
|
+
|
|
|
import os, sys, json
|
|
|
import csv
|
|
|
from collections import OrderedDict
|
|
@@ -64,15 +68,15 @@ class CsvStatementParser(object):
|
|
|
# Remember first line of each CSV file
|
|
|
if filename not in self.first_ops:
|
|
|
self.first_ops[filename] = ophash
|
|
|
- # Remember first line of each CSV file
|
|
|
+ # Remember last line of each CSV file
|
|
|
if filename not in self.last_ops:
|
|
|
self.last_ops[filename] = ophash
|
|
|
# CSV files are sometimes sorted by date ASC and sometimes
|
|
|
# sorted by date DESC. So we may need to swap first_op and last_op.
|
|
|
if (int(self.first_ops[filename][0:10].replace('-', '')) > int(self.last_ops[filename][0:10].replace('-', ''))):
|
|
|
- tmp = self.first_ops[filename]
|
|
|
- self.first_ops[filename] = self.last_ops[filename]
|
|
|
- self.last_ops[filename] = tmp
|
|
|
+ tmp = self.first_ops[filename]
|
|
|
+ self.first_ops[filename] = self.last_ops[filename]
|
|
|
+ self.last_ops[filename] = tmp
|
|
|
|
|
|
|
|
|
def dump_full(self, output_filename):
|
|
@@ -124,7 +128,7 @@ class CsvStatementParser(object):
|
|
|
are not "contiguous".
|
|
|
"""
|
|
|
self.badmonths = set()
|
|
|
- print("\nRecherche de chevauchements (les chevauchements de fichiers CSV c'est bien, ça rassure)...")
|
|
|
+ print("\nRecherche de chevauchements, car les chevauchements de fichiers CSV c'est bien, ça confirme qu'il n'y a pas d'écritures manquantes...")
|
|
|
for filename, first_op in self.first_ops.items():
|
|
|
if first_op in self.overlap_detector:
|
|
|
otherfiles = [v for v in self.overlap_detector.get(first_op)]
|