make things cleaner

This commit is contained in:
Pierre-antoine Comby 2020-05-26 23:53:13 +02:00
parent 985f7c7bcd
commit 5af336fff3
4 changed files with 5 additions and 4 deletions

View File

@ -19,7 +19,7 @@ def timed(method):
ts = time.time() ts = time.time()
result = method(*args, **kw) result = method(*args, **kw)
te = time.time() te = time.time()
args[0].print_success(f"{method.__name__} executed ({te-ts:.2f}s)") args[0].print_success(f"\n {method.__name__} executed ({te-ts:.2f}s)")
return result return result
return _timed return _timed

View File

@ -58,7 +58,7 @@ class Command(ImportCommand):
} }
# WARNING: Fields lieu, liste, listeimprimee are missing # WARNING: Fields lieu, liste, listeimprimee are missing
MAP_ACTIVITY[row["id"]] = pk_activity MAP_ACTIVITY[row["id"]] = pk_activity
pk_activity +=1 pk_activity += 1
bulk_mgr.add(Activity(**obj_dict)) bulk_mgr.add(Activity(**obj_dict))
bulk_mgr.done() bulk_mgr.done()

View File

@ -14,5 +14,5 @@ class Command(BaseCommand):
subprocess.call("./apps/scripts/shell/tabularasa") subprocess.call("./apps/scripts/shell/tabularasa")
call_command('import_account', alias=True, chunk=1000, save = "map.json") call_command('import_account', alias=True, chunk=1000, save = "map.json")
call_command('import_activities', chunk=100, map="map.json") call_command('import_activities', chunk=100, map="map.json")
call_command('import_transaction', buttons=True, map="map.json") call_command('import_transaction', chunk=10000, buttons=True, map="map.json")
# #

View File

@ -1,6 +1,7 @@
#!/usr/bin/sh #!/usr/bin/sh
sudo -u postgres sh -c "dropdb note_db && psql -c 'CREATE DATABASE note_db OWNER note;'"; sudo -u postgres sh -c "dropdb note_db && psql -c 'CREATE DATABASE note_db OWNER note;'";
echo 'reset db'; echo 'reset db';
source "env/bin/activate" find apps/ -path "*/migrations/*.py*" -not -name "__init__.py" -delete
./manage.py makemigrations
./manage.py migrate ./manage.py migrate
./manage.py loaddata initial ./manage.py loaddata initial