pondersource / prejournal

An experimental bookkeeping tool that sits between source documents and journals
https://prejournal.org
MIT License
2 stars 2 forks source link

worked-hours command not usable when user name != worker name #143

Closed gsvarovsky closed 1 year ago

gsvarovsky commented 1 year ago

Please can you check the server?

POST https://time.pondersource.com/v1/worked-hours
Authorization: Basic m-ld ***

["2022-08-15T10:36:26.127Z","worker","test/ts1",0,"testing"]

=>

<Response body is empty>

Response code: 500 (Internal Server Error); Time: 209ms (209 ms); Content length: 0 bytes (0 B)
michielbdejong commented 1 year ago

Yes, sorry. Maybe I can put the server in development mode so you can see the error message The logs say:

PHP Fatal error: Uncaught Error: UserId 2 is not allowed to create movements with fromComponent == 11; did you forget to run the claim-component command first? in /app/src/database.php:360

userId 2 is m-ld. componentId 11 is m-ld.

So this is a problem with the way I defined the command; you have nowhere to enter the 'worker' string! That position where you entered it is actually the 'client' string.

It would have failed anyway for worker 'worker' but for workers 'george' and 'angus' it would have worked if only you had a way to specify the worker...

I'll slap on an extra parameter on the end as a quick fix, although our patchwork of positional arguments are really showing signs of collapse here...

michielbdejong commented 1 year ago

See https://github.com/pondersource/prejournal/issues/144 for longer-term fix (switching from array-of-strings to object for the REST API request bodies).

michielbdejong commented 1 year ago

curl -i -d'["2022-08-15T10:36:26.127Z","Federated Timesheets Virtual Organisation","test/ts1",0,"testing","http://timeld.org/george"]' https://m-ld:***@time.pondersource.com/v1/worked-hours works now