DataONEorg / bookkeeper

Bookkeeper keeps track of DataONE product subscriptions and quotas for researchers using the extended services.
Other
1 stars 2 forks source link

Usage in the quota counts the inactive (archived) usages #52

Open taojing2002 opened 4 years ago

taojing2002 commented 4 years ago

The curl command:

curl -k  -v  -H "Authorization: Bearer ${token}" "https://api.test.dataone.org:30443/bookkeeper/v1/quotas?subscriber=CN=opc,DC=dataone,DC=org&quotaType=portal"

It returns a quota with usage 2.0

{"quotas":[{"id":4,"object":"quota","quotaType":"portal","softLimit":5.0,"hardLimit":5.0,"usage":2.0,"unit":"portal","subscriptionId":1,"subject":"CN=opc,DC=dataone,DC=org"}]}

However, when I list the usages associated with subscriber. It got two usages. However, one is inactive and it should NOT be counted. So the quota should have one usage rather than two.

curl -k  -v  -H "Authorization: Bearer ${token}" "https://api.test.dataone.org:30443/bookkeeper/v1/usages?subscriber=CN=opc,DC=dataone,DC=org&quotaType=portal"

It return with two usages. But one is inactive:

{"usages":[{"id":60,"object":"usage","quotaId":4,"instanceId":"urn:uuidc11e3c52-dad2-4ddb-8aeb-099e1ffe6533","quantity":1.0,"status":"active","nodeId":"urn:node:METACAT_TEST"},
{"id":61,"object":"usage","quotaId":4,"instanceId":"urn:uuidd991d85a-99ca-46b3-8f04-c8c560083505","quantity":1.0,"status":"inactive","nodeId":"urn:node:METACAT_TEST"}]}
csjx commented 4 years ago

This is fixed, and will be tested before I close the ticket.