tuttle-dev / tuttle

🪰 Tuttle - time and money management for freelancers
GNU General Public License v3.0
62 stars 12 forks source link

Test: time tracking from spreadsheets #173

Closed clstaudt closed 1 year ago

clstaudt commented 1 year ago

I sneakily tried uploading my toggle CSV export, which I did not really expect to work (and it didn't indeed :-)), but it would be nice to get some info here about what kind of CSV format is expected

clstaudt commented 1 year ago

Import from a .csv file created by Toggl works now. Data usability to be tested. 👍🏾

clstaudt commented 1 year ago
2023-02-01 23:00:39.637 | ERROR    | invoicing.intent:create_invoice:169 - Failed to create invoice. 
2023-02-01 23:00:39.638 | ERROR    | invoicing.intent:create_invoice:170 - 'all_day'
Traceback (most recent call last):

  File "/Users/cls/miniforge3/envs/tuttle/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3803, in get_loc
    return self._engine.get_loc(casted_key)
           │    │               └ 'all_day'
           │    └ <pandas._libs.properties.CachedProperty object at 0x11a821040>
           └ Index(['User', 'Email', 'Client', 'tag', 'title', 'description', 'Billable',
                    'Start date', 'Start time', 'End date', '...
  File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
    cpdef get_loc(self, object val):
  File "pandas/_libs/index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc
    return self.mapping.get_item(val)
  File "pandas/_libs/hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: 'all_day'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "/Users/cls/miniforge3/envs/tuttle/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
    │    └ <function Thread._bootstrap_inner at 0x102f269e0>
    └ <Thread(Thread-1037 (on_submit_btn_clicked), started daemon 6240792576)>
  File "/Users/cls/miniforge3/envs/tuttle/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
    │    └ <function Thread.run at 0x102f26710>
    └ <Thread(Thread-1037 (on_submit_btn_clicked), started daemon 6240792576)>
  File "/Users/cls/miniforge3/envs/tuttle/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
    │    │        │    │        │    └ {}
    │    │        │    │        └ <Thread(Thread-1037 (on_submit_btn_clicked), started daemon 6240792576)>
    │    │        │    └ (<flet.control_event.ControlEvent object at 0x11f0bd390>,)
    │    │        └ <Thread(Thread-1037 (on_submit_btn_clicked), started daemon 6240792576)>
    │    └ <bound method InvoicingEditorPopUp.on_submit_btn_clicked of <invoicing.view.InvoicingEditorPopUp object at 0x11cf8a500>>
    └ <Thread(Thread-1037 (on_submit_btn_clicked), started daemon 6240792576)>

  File "/Users/cls/Documents/Work/Projects/PrototypeFund/Dev/tuttle/app/invoicing/view.py", line 132, in on_submit_btn_clicked
    self.on_submit(self.invoice, self.project, from_date, to_date)
    │    │         │    │        │    │        │          └ datetime.date(2024, 2, 1)
    │    │         │    │        │    │        └ datetime.date(2021, 1, 31)
    │    │         │    │        │    └ Project(id=5, title=Heating Repair, tag=#HeatingRepair)
    │    │         │    │        └ <invoicing.view.InvoicingEditorPopUp object at 0x11cf8a500>
    │    │         │    └ Invoice(id=None, number='', date=datetime.date(2023, 2, 1), contract_id=None, project_id=None, sent=False, paid=False, cancel...
    │    │         └ <invoicing.view.InvoicingEditorPopUp object at 0x11cf8a500>
    │    └ <bound method InvoicingListView.on_save_invoice of <invoicing.view.InvoicingListView object at 0x11cc74b80>>
    └ <invoicing.view.InvoicingEditorPopUp object at 0x11cf8a500>

  File "/Users/cls/Documents/Work/Projects/PrototypeFund/Dev/tuttle/app/invoicing/view.py", line 310, in on_save_invoice
    result: IntentResult = self.intent.create_invoice(
                           │    │      └ <function InvoicingIntent.create_invoice at 0x11ca8d5a0>
                           │    └ <invoicing.intent.InvoicingIntent object at 0x11cc74bb0>
                           └ <invoicing.view.InvoicingListView object at 0x11cc74b80>

  File "/Users/cls/Documents/Work/Projects/PrototypeFund/Dev/tuttle/app/core/abstractions.py", line 294, in wrapped
    return attr(*args, **kwargs)
           │     │       └ {'invoice_date': datetime.date(2023, 2, 1), 'project': Project(id=5, title=Heating Repair, tag=#HeatingRepair), 'from_date': ...
           │     └ ()
           └ <bound method InvoicingIntent.create_invoice of <invoicing.intent.InvoicingIntent object at 0x11cc74bb0>>

> File "/Users/cls/Documents/Work/Projects/PrototypeFund/Dev/tuttle/app/invoicing/intent.py", line 104, in create_invoice
    timesheet: Timesheet = timetracking.generate_timesheet(
                           │            └ <function generate_timesheet at 0x11bcf9e10>
                           └ <module 'tuttle.timetracking' from '/Users/cls/Documents/Work/Projects/PrototypeFund/Dev/tuttle/tuttle/timetracking.py'>

  File "/Users/cls/Documents/Work/Projects/PrototypeFund/Dev/tuttle/tuttle/timetracking.py", line 45, in generate_timesheet
    ts_table.loc[ts_table["all_day"], "duration"] = (
    │        │   └                       User             Email  ... Tags                 end
    │        │     begin                                         ... ...
    │        └ <property object at 0x11ae30680>
    └                       User             Email  ... Tags                 end
      begin                                         ... ...

  File "/Users/cls/miniforge3/envs/tuttle/lib/python3.10/site-packages/pandas/core/frame.py", line 3805, in __getitem__
    indexer = self.columns.get_loc(key)
              │    │               └ 'all_day'
              │    └ <pandas._libs.properties.AxisProperty object at 0x11b0a4190>
              └                       User             Email  ... Tags                 end
                begin                                         ... ...
  File "/Users/cls/miniforge3/envs/tuttle/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc
    raise KeyError(key) from err
                   └ 'all_day'

KeyError: 'all_day'