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

Missing timer coverage for POST /api/pumpings #826

Open
skjdghsdjgsdj opened this issue May 19, 2024 · 2 comments
Open

Missing timer coverage for POST /api/pumpings #826

skjdghsdjgsdj opened this issue May 19, 2024 · 2 comments
Labels
enhancement Feature requests or improvements to existing functionality good first issue Good candidates for simple work for first time contributors

Comments

@skjdghsdjgsdj
Copy link

It looks like, while you can create a pumping entry through the web interface from a timer, the API coverage lacks the ability:

curl -v -H 'Authorization: Token ...' -H 'Content-Type: application/json'
    -X POST -d '{"child": 1, "amount": 10, "timer": 327}' 'https://.../api/pumping/'

results in:

{"id":18,"child":1,"amount":10.0,"start":"2024-05-19T16:41:49.978134-00:00",
"end":"2024-05-19T16:41:49.978145-00:00","duration":"00:00:00.000011","notes":null,"tags":[]}%

Note the duration is effectively zero, not what timer 327 was tracking.

While I could use the API to just read the start of a timer and calculate the end, then POST accordingly, it would be far simpler if the schema accepted timer IDs like feedings do, and like the web UI implies is possible.

Schema attached that shows a missing timer ID field.

@skjdghsdjgsdj
Copy link
Author

Screenshot 2024-05-19 at 5 03 35 PM GitHub in Firefox didn't attach the image so here's trying from Safari.

@cdubz
Copy link
Member

cdubz commented May 20, 2024

Thanks for flagging. I think we just need to change the PumpingSerializer @

class PumpingSerializer(CoreModelSerializer, TaggableSerializer):
class Meta:
model = models.Pumping
fields = ("id", "child", "amount", "start", "end", "duration", "notes", "tags")

to extend CoreModelWithDurationSerializer instead of CoreModelSerializer (as FeedingSerializer does).

@cdubz cdubz added enhancement Feature requests or improvements to existing functionality good first issue Good candidates for simple work for first time contributors labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests or improvements to existing functionality good first issue Good candidates for simple work for first time contributors
Projects
None yet
Development

No branches or pull requests

2 participants