trolster / urcli

CLI tool for the Udacity Reviews API
MIT License
100 stars 23 forks source link

Bug Report: Invalid Date for Average Turnaround Time #77

Closed ajhollid closed 7 years ago

ajhollid commented 7 years ago

Which version of Node.js are you running (node -v)?

7.8.0

Which version of urcli are you running (urcli -V)?

2.5.2

What behavior were you expecting to see?

Total revenue and daily average calculated and displayed

What was the actual behavior?

"Earned" field is still calculated for each project except the one with the invalid date, "Total Earned" and "Daily Average" are not calculated correctly

Describe the steps needed to reproduce the problem?

  1. I have one project with an "Average Turnaround Time" with the value "Invalid Date".
  2. Run "urcli revenue" and the "Total Earned" and "Daily Average" fields have a value of "$0.00"

What is your Operating System (e.g., Linux Ubuntu, MacOS, Windows)?

Windows 8.1, Linux - Raspbian Jessie

trolster commented 7 years ago

Hi @popnfresh234, I'm updating urcli to v4 today, so can you update as well and see if it resolves the issue? The easiest way is to just reinstall: npm install -g urcli. Make sure you have v4 installed: urcli -V.

gabraganca commented 7 years ago

Hi @popnfresh234 . You mentioned that you have a project with an invalid date. How come? Could you provide more information on this?

ajhollid commented 7 years ago

Hi @gabraganca ,

I don't know why I have a project with an invalid date for turnaround time, I just noticed it the other day when I tried to run the revenue command

@trolster I've updated to v4 and the issue still persists. Running revenue also generates an empty report if you don't include --from now as well

gabraganca commented 7 years ago

OK. Let's trace this bug.

If you try using revenue for other months or other periods of time, do you still get the invalid turnaround time?

Also, could you update your token to see if it solves it?

@trolster I've updated to v4 and the issue still persists. Running revenue also generates an empty report if you don't include --from now as well

Which date did you use after the --flag to get it working?

trolster commented 7 years ago

@popnfresh234, also, can you paste in the output? I'd like to see what you mean by an empty report.

ajhollid commented 7 years ago

@trolster @gabraganca

I've updated my token when I updated urcli, seems to be the same results.

Here is the report if I just run urcli revenue right now.

Earnings Report for undefined to 2017-05-30:

Total Projects Assigned: 0

Total Earned: $0.00

The revenue command still works for any period of time where that invalid date

Here is the output for urcli revenue --from 2017-05-01 --to 2017-05-29:

============================================= Total Projects Assigned: 479

Project: Score Keeper (157):
----------------------------
    Total Assigned: 78
        Reviewed: 67
        Ungradeable: 11
    Earned: $926.00
    Average Turnaround Time: 07:07

Project: Quiz App (158):
------------------------
    Total Assigned: 142
        Reviewed: 133
        Ungradeable: 9
    Earned: $0.00
    Average Turnaround Time: Invalid date

Project: Musical Structure (159):
---------------------------------
    Total Assigned: 14
        Reviewed: 11
        Ungradeable: 3
    Earned: $114.00
    Average Turnaround Time: 07:15

Project: ReportCard (160):
--------------------------
    Total Assigned: 138
        Reviewed: 125
        Ungradeable: 13
    Earned: $1,190.00
    Average Turnaround Time: 01:02

Project: Habit Tracker (162):
-----------------------------
    Total Assigned: 55
        Reviewed: 51
        Ungradeable: 4
    Earned: $683.00
    Average Turnaround Time: 01:41

Project: Inventory App (163):
-----------------------------
    Total Assigned: 7
        Reviewed: 7
        Ungradeable: 0
    Earned: $154.00
    Average Turnaround Time: 03:29

Project: Book Listing (164):
----------------------------
    Total Assigned: 44
        Reviewed: 40
        Ungradeable: 4
    Earned: $540.00
    Average Turnaround Time: 09:35

Project: News App (165):
------------------------
    Total Assigned: 1
        Reviewed: 1
        Ungradeable: 0
    Earned: $27.00
    Average Turnaround Time: 00:09

Total Earned: $0.00

You can see the invalid date for the "Quiz App" project. The problematic date is 2017-05-26, if I use any range that excludes that date all works as expected

gabraganca commented 7 years ago

Thanks for providing the revenue output.

Do you know the Review ID that has the invalid date? If not, could you find it using this tool? I want to find what is wrong with this review.

ajhollid commented 7 years ago

@gabraganca The id of the problematic review is 518032. This review was manually assigned, so it looks like it has some invalid data:

Review ID: 518032 Project Title: Quiz App (ID: 158) Project Status: completed (Earned: $0) Grader: Alex (ID: 5939) User: Amanda (ID: 112512) Created: Fri, May 26, 2017 7:31 AM Assigned: Invalid date Completed: Fri, May 26, 2017 8:14 AM Updated: Fri, May 26, 2017 8:14 AM Time to finish: 00:00:00

I should have mentioned that, I totally forgot about that manually assigned review until I inspected with the tool above!

gabraganca commented 7 years ago

By "manually assigned" do you mean that you assign it to yourself using Udacity's Reviewer Dashboard? If yes, that would not be a problem.

The issue seems to be in other entries: Earned, Assigned and Time to Finish. It seems that there were some issues on the server side.

@trolster what do you think?

trolster commented 7 years ago

Yeah, this is definitely an invalid review object. It doesn't conform to the API spec. Blame Amanda!! 👍 :smile:. @popnfresh234, it looks like it might mess up future commands also, so you may want to ask Amanda to remove it, or give it a valid date.

ajhollid commented 7 years ago

@gabraganca the Android service lead added the project to my queue manually from his end, so no, not from the dashboard on my end.

Thank you and @trolster for taking the time to look into this, I will ask Amanda to look into it :+1:

trolster commented 7 years ago

If it was Android I think it might be John Shea you need to talk to. And no worries, thanks for taking the time to report it. I'll let the good people at Udacity know that they can cause issues if they create new reviews without adhering to the spec.

trolster commented 7 years ago

As it turns out, the API calls the date in assigned_at "optional" (thanks John for letting me know), which is not very helpful at all. But it means that it's urcli that's not conforming to the spec. So I'll have to revisit this. I'll reopen but keep discussion on slack with the Udacity folks.

trolster commented 7 years ago

After discussions with Udacity staff, I've concluded that this is a one-off event, and that Udacity does not have procedures in place which would afford this error ever coming up again. So they will ignore it on the API side, and we'll ignore it on the CLI side :-).