Skip to content

[$50]Fix weekly-count for taas-teams #16

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

Closed
veshu opened this issue Nov 27, 2020 · 14 comments
Closed

[$50]Fix weekly-count for taas-teams #16

veshu opened this issue Nov 27, 2020 · 14 comments

Comments

@veshu
Copy link
Contributor

veshu commented Nov 27, 2020

http://api.topcoder-dev.com/v5/taas-teams
Currently, teams are listed but the calculation for the weekly count is coming as zero. This has to be fixed

Branch: Dev

@veshu
Copy link
Contributor Author

veshu commented Nov 27, 2020

Contest https://www.topcoder.com/challenges/30154003 has been created for this ticket.

This is an automated message for veshu via Topcoder X

@veshu
Copy link
Contributor Author

veshu commented Nov 27, 2020

Contest https://www.topcoder.com/challenges/30154003 has been updated - it has been assigned to aaron2017.

This is an automated message for veshu via Topcoder X

@imcaizheng
Copy link
Contributor

@veshu
I am not quite sure if current implementation of weekly count is correct or not.

I tried to extract the business logic about the weekly count from the source code, as follows:

For a team, for every resource bookings of the team, only when the resource booking was started before the first day of current week and is to be ended after the last day of current week, the customer rate of the resource booking would be added to weekly count(cost).

Let's take an example, say, today is Nov 27, so the beginning of this week is Nov 22(Sunday) and the end of this week is Nov 28(Saturday).

  1. the following resourceBooking won't fullfilled the conditions because its startDate is larger than Nov 22.
{
    "projectId": 16704,
    "userId": "3f64739e-10bf-42ca-8314-8aea0245cd0f",
    "jobId": "1a5f81ca-65e1-4022-b997-6ab0f9140aa0",
    "startDate": "2020-11-27T04:17:23.131Z",
    "endDate": "2020-12-27T04:17:23.131Z",
    "memberRate": 13.23,
    "customerRate": 113,
    "rateType": "weekly",
    "createdAt": "2020-11-19T09:55:40.896Z",
    "createdBy": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
    "status": "sourcing",
    "updatedBy": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
    "updatedAt": "2020-11-19T09:58:08.413Z",
    "id": "cd32fce8-7cbb-4a8e-ad32-b5dc8e495f47"
}
  1. this one won't fullfilled the conditions as well. Because its endDate is less than Nov 22.
{
    "projectId": 61,
    "userId": "3f64739e-10bf-42ca-8314-8aea0245cd0f",
    "jobId": "0c1e518f-7aad-47f6-81e1-1d0aedb1e9b6",
    "startDate": "2020-09-27T04:17:23.131Z",
    "endDate": "2020-09-27T04:17:23.131Z",
    "memberRate": 61,
    "customerRate": 61,
    "rateType": "weekly",
    "createdAt": "2020-11-18T08:24:59.286Z",
    "createdBy": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
    "status": "sourcing",
    "id": "c8189e84-6cd6-41f8-bbf5-0c692a38594d"
}
  1. this one's customerRate will be added to weekly count.
{
  "projectId": 16705,
  "userId": "df2f0027-f74f-45fa-85cd-84c9fdc2faf4",
  "jobId": "2de6b167-8c6a-44dd-a6a2-8abd8bf6443b",
  "startDate": "2020-11-15T04:17:23.131Z",
  "endDate": "2020-12-15T04:17:23.131Z",
  "memberRate": 200,
  "customerRate": 200,
  "rateType": "weekly",
  "createdAt": "2020-11-18T16:24:02.682Z",
  "createdBy": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
  "status": "assigned",
  "updatedBy": "a55fe1bc-1754-45fa-9adc-cf3d6d7c377a",
  "updatedAt": "2020-11-18T16:24:56.797Z",
  "id": "a7a65205-d7c5-4725-a1db-923543e621b1"
}

Is current implementation desired? If not, please tell me what it should be so that I can fix it.

@veshu
Copy link
Contributor Author

veshu commented Nov 28, 2020

@imcaizheng if the startdate and end date overlaps the current week then only show.
So for this week any resources whose startdate is less the weekEndDate and end date is greater than weekStartDate should be considered

@imcaizheng
Copy link
Contributor

@veshu
Thanks for clarification. PR submitted. See #20

@veshu
Copy link
Contributor Author

veshu commented Dec 2, 2020

Payment task has been updated: https://software.topcoder.com/review/actions/ViewProjectDetails?pid=30154003

This is an automated message for veshu via Topcoder X

@nkumar-topcoder
Copy link
Contributor

@wdprice
Check the logic for weekly count above. As this involves $ calculation :-)

  1. I would prefer, weekly count to be counting the (first resource booking start date - last resource booking end date)/7. If it comes in decimal ex: 25/7 = 3.51. above 0.5 round-off 4 weeks. Below 0.5 round-down to week as 3 weeks.
  2. Business logic wise backdate of resource is possible, right ? If I backdate and resource is assigned status ideally from that start date weekly count should be calculated.
  3. If we go by sunday as startdate as given in the above example (1), we might miss weekly count completely.

@imcaizheng
Check my email, I have given as start and enddate as per your example (3), but still I am not getting weekly count.

@imcaizheng
Copy link
Contributor

@nkumar-topcoder
It is because weekEndDate is not correctly calculated. See PR #28

@nkumar-topcoder
Copy link
Contributor

@veshu need your input.

We have weekly count vs weekly cost and time remaining in week. can you pls clarify how these calculated and displayed at frontend.

@maxceem @imcaizheng

@nkumar-topcoder
Copy link
Contributor

Going by our earlier challenge
https://www.topcoder.com/challenges/742acfca-da8f-447c-b700-67298ac9a8c4
weeklycost and weeklycount got mixed up ?

@veshu
Copy link
Contributor Author

veshu commented Dec 3, 2020

@nkumar-topcoder

what does weekly count mean?
Currently, the weekly cost is the sum of all resources that are billed this week.
what is time remaining in week field?

@nkumar-topcoder
Copy link
Contributor

The weekly count is output of {{URL}}/taas-teams/{projectid}
that's what i meant weeklycost and weeklycount mix up

{
"id":,
"name": "",
"weeklyCount": 2913,
"resources": [
{
"id": "5bd69a82-c2cb-476f-9462-0883d3b28b90",
"handle": "",
"firstName": "Mekhi",

@veshu
Copy link
Contributor Author

veshu commented Dec 3, 2020

oh @nkumar-topcoder we can rename that field to weeklyCost

@maxceem
Copy link
Contributor

maxceem commented Dec 7, 2020

Closing this issue as it's done per description and created a new one to handle renaming #47

@maxceem maxceem closed this as completed Dec 7, 2020
@maxceem maxceem added this to the v1.0 - Initial Launch milestone Feb 24, 2021
deblasis added a commit to deblasis/taas-apis that referenced this issue Oct 8, 2021
* Get User Meeting Settings Endpoint
Fixes topcoder-platform#9

Signed-off-by: Alessandro De Blasis <[email protected]>

* Get User Meeting Settings Endpoint
Fixes topcoder-platform#9

Signed-off-by: Alessandro De Blasis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants