<commit_before># Controller used for simple tracking with GET requests

class TrackingController < ApplicationController
  before_filter :authenticate_with_token
  before_filter :find_track

  def track
    coordinate = @track.coordinates.build params
    coordinate.user_id = @user.id
    if coordinate.save
      head :ok
    else
      head :unprocessable_entity
    end
  end

  private

  def authenticate_with_token
    @user = User.find_by_token params[:token]
    head :unauthorized unless @user
  end

  def find_track
    @track = Track.find_by_name params[:track]
    unless @track
      @track = Track.new :name => params[:track]
      @track.user = @user
      head :unprocessable_entity unless @track.save
    end
  end
end
<commit_msg>Introduce param for time in milliseconds<commit_after># Controller used for simple tracking with GET requests

class TrackingController < ApplicationController
  before_filter :authenticate_with_token
  before_filter :find_track

  def track
    coordinate = @track.coordinates.build params
    coordinate.time = Time.at(params[:millis].to_i / 1000) if params[:millis]
    coordinate.user_id = @user.id
    if coordinate.save
      head :ok
    else
      head :unprocessable_entity
    end
  end

  private

  def authenticate_with_token
    @user = User.find_by_token params[:token]
    head :unauthorized unless @user
  end

  def find_track
    @track = Track.find_by_name params[:track]
    unless @track
      @track = Track.new :name => params[:track]
      @track.user = @user
      head :unprocessable_entity unless @track.save
    end
  end
end

{'fraction_non_alphanumeric': 0.0691588785046729, 'fraction_numerical': 0.0024922118380062306, 'mean_word_length': 3.3523035230352303, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '351948', 'n_tokens_mistral': 488, 'n_tokens_neox': 470, 'n_words': 136}