Work Hour Calculation

How Work Hours Are Calculated

Our system uses a sophisticated algorithm to estimate work hours based on commit patterns. Instead of using a simple fixed-time-per-commit approach, we group commits into work sessions and calculate hours based on multiple factors.

The Algorithm

  1. Commit Grouping: Commits by the same author are grouped into work sessions if they occur within 6 hours of each other.
  2. Session Duration Calculation: We calculate the time between the first and last commit in a session to determine the actual working duration.
  3. Preparation Time: Each work session includes 2 hours of preparation time, recognizing the setup work, planning, and research done before and between coding and committing.
  4. Total Session Time: The total time for a session is simply:
    Session Duration + Preparation Time
// Calculate session time
// Get session duration (time between first and last commit)
const sessionDurationHours = (endTime - startTime) / (1000 * 60 * 60);

// Calculate total time: duration + prep time
let sessionHours = sessionDurationHours + prepTime;

Customize Calculation Parameters

You can adjust how work hours are calculated by changing the parameters below. These changes will affect how all repositories work hours are calculated.

Work Session Configuration

Why This Approach?

Different developers have different commit styles. Some commit frequently in small increments, while others make fewer, larger commits. A simple "X hours per commit" approach would either overestimate time for frequent committers or underestimate for infrequent ones.

By grouping commits into work sessions and applying a more nuanced calculation, we provide a fairer estimate of work hours across different commit styles.

This approach recognizes that:

  • Coding involves more than just committing (thinking, debugging, testing)
  • Multiple commits in proximity likely represent a single work session
  • There are reasonable minimum and maximum bounds on work session lengths

The algorithm is transparent, and you can see the detailed calculation for each work session in the repository cards by expanding a contributor's details.