Merge pull request #435 from ImShyMike/fix-missing-category

This commit is contained in:
Echo 2025-07-24 17:11:00 -04:00 committed by GitHub
commit 6fa5de67cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View file

@ -108,7 +108,7 @@ GEM
bindex (0.8.1)
bootsnap (1.18.6)
msgpack (~> 1.2)
brakeman (7.0.2)
brakeman (7.1.0)
racc
builder (3.3.0)
bullet (8.0.8)

View file

@ -236,6 +236,9 @@ class Api::Hackatime::V1::HackatimeController < ApplicationController
parsed_ua = WakatimeService.parse_user_agent(heartbeat[:user_agent])
# if category is not set, just default to coding
heartbeat[:category] ||= "coding"
# special case: if the entity is "test.txt", this is a test heartbeat
if heartbeat[:entity] == "test.txt"
source_type = :test_entry

View file

@ -3,7 +3,7 @@ include ApplicationHelper
class TestWakatimeService
def initialize(user: nil, specific_filters: [], allow_cache: true, limit: 10, start_date: nil, end_date: nil, scope: nil, boundary_aware: false)
@scope = scope || Heartbeat.all
# trusting time from hackatime extensions.....
# trusting time from hackatime extensions.....
# @scope = @scope.coding_only
@scope = @scope.with_valid_timestamps
@user = user