Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gsvarovsky opened this issue Aug 26, 2022 · 3 comments
Closed

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

gsvarovsky opened this issue Aug 26, 2022 · 3 comments

Comments

@gsvarovsky
Copy link

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 michielbdejong changed the title time.pondersource.com responding 500 Internal Server Error worked-hours command not usable when user name != worker name Aug 26, 2022
@michielbdejong
Copy link
Member

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
Copy link
Member

michielbdejong commented Aug 26, 2022

See #144 for longer-term fix (switching from array-of-strings to object for the REST API request bodies).

@michielbdejong
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants