<commit_before>module Skr

    class TimeEntry < Model

        belongs_to :customer_project, inverse_of: :time_entries, export: true

        belongs_to :lanes_user, class_name: 'Lanes::User', export: true

        validates :start_at, :end_at, :description, presence: true

        validates :customer_project, :lanes_user, set: true


        has_one :inv_line, inverse_of: :time_entry, listen: { create: :mark_as_invoiced }

        private

        def mark_as_invoiced(inv_line)
            update_attributes(is_invoiced: true)
        end
    end

end<commit_msg>Calculate duration of entry in hours<commit_after>module Skr

    class TimeEntry < Model

        belongs_to :customer_project, inverse_of: :time_entries, export: true

        belongs_to :lanes_user, class_name: 'Lanes::User', export: true

        validates :start_at, :end_at, :description, presence: true

        validates :customer_project, :lanes_user, set: true


        has_one :inv_line, inverse_of: :time_entry, listen: { create: :mark_as_invoiced }

        def hours
            (end_at - start_at) / 1.hour
        end

        private

        def mark_as_invoiced(inv_line)
            update_attributes(is_invoiced: true)
        end

    end

end
{'fraction_non_alphanumeric': 0.0784789644012945, 'fraction_numerical': 0.0008090614886731392, 'mean_word_length': 2.806153846153846, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3599750', 'n_tokens_mistral': 402, 'n_tokens_neox': 383, 'n_words': 96}