nicoschmdt opened a new pull request, #10200: URL: https://github.com/apache/cloudstack/pull/10200
### Description This PR adds the `account.created` preset variable to Quota tariffs, allowing users to consider an account's creation date when defining values to, for instance, grant a discount on the first month. This variable is injected as a String. Therefore, users need to parse it first: `Date.parse(account.created)`. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [x] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] build/CI - [ ] test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [x] Minor ### How Has This Been Tested? In a local lab, the billing of two accounts was compared in relation to the amount of VM snapshots each one has. - User Account: created on 17 Oct 2024 17:36:46, with 3 VM snapshots - Root Account: created on 24 Oct 2024 13:51:35, with 1 VM snapshot The base script for the activation rule used was: ```js today = new Date(); // current date was 24 Oct 2024 daysDiff = (today-Date.parse(account.created))/(1000*60*60*24); if (daysDiff <= 5 && daysDiff >= 0) { 20 } else { 0 } ``` When `daysDiff` is less than or equal to 15 both accounts were charged. When `daysDiff` is less than or equal to 5 only the Root Account was charged. It was noted that the first Root Account created by ACS doesn't have a creation date so the script was changed to: ```js today = new Date(); daysDiff = (today-Date.parse(account.created))/(1000*60*60*24); if (daysDiff <= 30 && daysDiff >= 0) { 0 } else { 20 } ``` In this condition, it was observed that the first Root Account was charged while the others weren't. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org