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

Track usage of credit for a second month #37

Closed
2 tasks
knikolla opened this issue May 2, 2024 · 6 comments · Fixed by #44
Closed
2 tasks

Track usage of credit for a second month #37

knikolla opened this issue May 2, 2024 · 6 comments · Fixed by #44
Assignees

Comments

@knikolla
Copy link
Contributor

knikolla commented May 2, 2024

Motivation

Deal with the case where a user starts a project late in a month. We don't want them to loose out on the intro credit.

Completion Criteria

automate tracking of new PIs so that we provide the 0002 credit for the first 2 months they show up on the invoice.

Description

  • Create a way to track the $1000 so that we know how much is left after the first month
    • new columns in the pi.csv might work to provide the amount and then we need to check the month associated and subtract the first month from the amount column and then, subtract the amount from the 2nd month and then never touch it again as they are past the 2 month mark
      • This will also allow for tracking of how much was used of the credit
      • 3 new columns in pi.csv amount, Initial Credit Amount - currently $1000, might change, after 1st month, after 2nd month
        • Initial Credit Amount is the credit offered at the time of the first month they were added to the list, it will not change in the future if the credit amount changes in the future.
          • Initial Credit Amount is the value for future runs if the script needs to be run again, that way if it changes in later months the new value is added to pi.csv and becomes the value that will always be used for that row
        • after 1st month = Initial Credit Amount - Cost for 1st month, down to min 0
        • after 2nd month = Initial Credit Amount - Cost for 1st month - Cost for 2nd month, down to min 0
      • make sure that rerunning the script does not create different values
  • test that 2nd month the remaining value is used
    • test when more than the amount is used, what does the invoice show and what does the pi.csv show
    • test when less than the amount is used, what does the invoice show and what does the pi.csv show

Example

  1. PI1 joins in Jan uses $200
  2. PI2 joins in Jan uses $600
  3. PI3 joins in Feb and the credit amount drops to $500 and they use $200
  4. PI1 uses $300 in Feb
  5. PI2 uses $700 in Feb
  6. PI3 uses $250 in Mar
  7. pi.csv columns
    1. PI1, 2024-01, 1000, 800, 500
    2. PI2, 2024-01, 1000, 400, 0
    3. PI3, 2024-02, 500, 300, 50
  8. Invoice column PI, Month, Cost, credit, Balance
    1. PI1, 2024-01, 200, 200, 0
    2. PI2, 2024-01, 600, 600, 0
    3. PI1, 2024-02, 300, 300, 0
    4. PI2, 2024-02, 700, 400, 300
    5. PI3, 2024-02, 200, 200, 0
    6. PI3, 2024-03, 250, 250, 50

Completion dates

Desired - 2024-05-29
Required - TBD

@QuanMPhm
Copy link
Contributor

QuanMPhm commented May 3, 2024

@knikolla How much should I do error checking for the PI file? Should I make any assumptions about it?

@knikolla
Copy link
Contributor Author

knikolla commented May 3, 2024

@knikolla How much should I do error checking for the PI file? Should I make any assumptions about it?

@QuanMPhm what kind of errors do you have in mind?

@QuanMPhm
Copy link
Contributor

QuanMPhm commented May 3, 2024

During our discussion today, I mentioned that if we cannot assume that certain fields in the PI.csv will follow certain constraints, then there might be several cases where the script might encounter errors when applying the PI credit. For example:

  • If the Initial Credit Amount and After 1st Month field may not be set, when the script tries to apply the credit to PIs during their second month of appearing in invoices (1-month PIs), it has not way of knowing how many credits those PIs should be given.

I have another edge case that would take a while to write down, and I think there may be more as I write the test cases for applying the credit. I suggested in the meeting that I'll make a script to create a "well-formatted" PI.csv with all the additional columns filled out

@joachimweyl
Copy link
Contributor

@QuanMPhm I thought this was already in the script. Is there a piece of this that I missed?

@QuanMPhm
Copy link
Contributor

@joachimweyl We haven't done any tracking yet for the usage of the New-PI credit. I'm not sure if I ever told you we already had this feature in the script. If I did, it may have been a mistake?

@joachimweyl
Copy link
Contributor

Understood. Thank you for the update.

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

Successfully merging a pull request may close this issue.

3 participants