rstudio / rscloud

Managing RStudio Cloud spaces with R
https://rstudio.github.io/rscloud
Other
22 stars 11 forks source link

`space_member_usage()` shouldn't fail when `last_activity` is not available #46

Closed mine-cetinkaya-rundel closed 2 years ago

mine-cetinkaya-rundel commented 2 years ago

A change in the API since the first implementation of space_member_usage() has caused last_activity() to not be available in what's returned from the RETRIEVE SPACE USAGE SUMMARY call. The existing code was not robust to last_activity being returned from the API to be NULL. With this change the NULL result for last_activity is now converted to NA and hence the rest of the calculations that rely on last_activity don't fail as it no longer gets dropped.

If/when the API is updated to return last_activity this revised code for space_member_usage() should still work. Alternatively, we might add additional arguments to space_member_usage() in the future to explicitly ask for last_activity to be returned. For now, the code works but space_member_usage() reports NA for last_activity.

Closes #43 and #40.