<commit_before><?

abstract class Controller_Ratings extends Controller {
   
   protected static $__CLASS__ = __CLASS__;
   
   protected static $objectTable = 'objects';
   
   protected $ratings = null;
   
   public static function Factory($class){
      
      $class = $class.'_Controller';
      return new $class;
   }

   private static function getObjectTypeId(){
      $ratingsObjectType = ORM::Factory('ratingsobjecttype')->where('object_type', '=', self::$objectTable )->find();
      if(!$ratingsObjectType->loaded()){
         $ratingsObjectType = ORM::Factory('ratingsobjecttype');
         $ratingsObjectType->object_type = self::$objectTable;
         $ratingsObjectType->save();
      }
      return $ratingsObjectType->id;
      
   }
   
   public function storeRating($object_id, $userRating) {
      
      $objectTypeId = self::getObjectTypeId();
      $user_id = Session::instance()->get('auth_user')->id;
      $rating = ORM::Factory('rating');
			$rating->where('object_id', '=', $object_id);
			$rating->where('object_type_id', '=', $objectTypeId);
			$rating->where('user_id', '=', $user_id );
			$rating->find();
			if($rating->loaded()){
				$rating = ORM::Factory('rating', $rating->id);
			} else {
				$rating = ORM::Factory('rating');
			}

      $rating->object_id = $object_id;<commit_msg>Updated public action to K3 action_ name format<commit_after><?

abstract class Controller_Ratings extends Controller {
   
   protected static $__CLASS__ = __CLASS__;
   
   protected static $objectTable = 'objects';
   
   protected $ratings = null;
   
   public static function Factory($class){
      
      $class = $class.'_Controller';
      return new $class;
   }

   private static function getObjectTypeId(){
      $ratingsObjectType = ORM::Factory('ratingsobjecttype')->where('object_type', '=', self::$objectTable )->find();
      if(!$ratingsObjectType->loaded()){
         $ratingsObjectType = ORM::Factory('ratingsobjecttype');
         $ratingsObjectType->object_type = self::$objectTable;
         $ratingsObjectType->save();
      }
      return $ratingsObjectType->id;
      
   }
   
   public function action_storeRating($object_id, $userRating) {
      
      $objectTypeId = self::getObjectTypeId();
      $user_id = Session::instance()->get('auth_user')->id;
      $rating = ORM::Factory('rating');
			$rating->where('object_id', '=', $object_id);
			$rating->where('object_type_id', '=', $objectTypeId);
			$rating->where('user_id', '=', $user_id );
			$rating->find();
			if($rating->loaded()){
				$rating = ORM::Factory('rating', $rating->id);
			} else {
				$rating = ORM::Factory('rating');
			}

      $rating->object_id = $object_id;
{'fraction_non_alphanumeric': 0.1656145562569625, 'fraction_numerical': 0.0003713330857779428, 'mean_word_length': 3.5353535353535355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '99431', 'n_tokens_mistral': 872, 'n_tokens_neox': 826, 'n_words': 142}