Code Monkey home page Code Monkey logo

average-hours's People

Contributors

martijngastkemper avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

minkekampman

average-hours's Issues

Local development errors

After cloning the repository and running npm install I tried the proposed local development route, but got an error:

$ npx serverless invoke local --function slack --path test/slack-command-average-hours-20-days.json
{
    "errorMessage": "Cannot read property 'data' of undefined",
    "errorType": "TypeError",
    "stackTrace": [
        "TypeError: Cannot read property 'data' of undefined",
        "    at module.exports.slack (/Users/harmen/Code/average-hours/handler.js:62:44)",
        "    at processTicksAndRejections (node:internal/process/task_queues:96:5)"
    ]
}

Is there anything more I should do to setup local development?

Take working days into account when calculating average

Problem: currently, doing a little work on a Sunday will throw off your average, whereas it should actually beef up your average.
Proposal: do not use total days to calculate the average, but only use the "official" working days. Example: working 8 hours for 4 days and doing a 1 hour job on Sunday should show an average of 8,25 hours instead of 6,6 hours.

I found that the following API contains a person's working days: https://api.productive.io/api/v2/timesheet_reports?filter%5Bafter%5D=2021-06-21&filter%5Bbefore%5D=2021-06-27&filter%5Bperson_id%5D=41757&page=1&per_page=200

Example output:

"attributes": {
    "week": "2021/W25",
    "monday_time": 579,
    "monday_capacity": 480,
    "monday_available": 450,
    "tuesday_time": 488,
    "tuesday_capacity": 480,
    "tuesday_available": 450,
    "wednesday_time": 394,
    "wednesday_capacity": 480,
    "wednesday_available": 450,
    "thursday_time": 452,
    "thursday_capacity": 480,
    "thursday_available": 450,
    "friday_time": 11,
    "friday_capacity": 0,
    "friday_available": 0,
    "saturday_time": 0,
    "saturday_capacity": 0,
    "saturday_available": 0,
    "sunday_time": 0,
    "sunday_capacity": 0,
    "sunday_available": 0
}

I think the _capacity or _available keys are significant here, although I don't understand the difference.
But either of them shows that I am not working on Friday for instance. I think we can use that to gather a person's working days from the given date and come up with the correct average.

I would work on this myself but I don't have local development figured out yet. (see other issue)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.