<commit_before><?php
defined('BASEPATH') or exit('No direct script access allowed');

// payer_model.php <NAME> Dec 14, 2013 5:47:05 PM
// <EMAIL>
class Payer_model extends CI_Model
{
    var $payment_type;
    var $room_size;
    var $discount;
    var $amt_paid;
    var $notes;

    function __construct ()
    {
        parent::__construct();
    }

    function prepare_variables ()
    {
        $variables = array(
                "payment_type",
                "room_size",
                "discount",
                "amt_paid",
                "notes"
        );
        for ($i = 0; $i < count($variables); $i ++) {
            $my_variable = $variables[$i];
            if ($this->input->post($my_variable)) {
                if ($my_variable == "discount" || $my_variable == "amt_paid") {
                    $this->$my_variable = format_money($this->input->post($my_variable), "int");
                }
                $this->$my_variable = $this->input->post($my_variable);
            }
        }
    }

    function get_for_tour ($payer_id, $tour_id)
    {
        $this->db->from("payer");
        $this->db->join("tour", "payer.tour_id=tour.id");
        $this->db->join("person", "payer.payer_id=person.id");
        $this->db->where("payer.payer_id", $payer_id);
        $this->db->where("payer.tour_id", $tour_id);
        $this->db->select(
                "tour.tour_name,tour.full_price, tour.banquet_price, tour.early_price, tour.regular_price,tour.single_room, tour.triple_room, tour.quad_room");
        $this->db->select("person.first_name, person.last_name");
        $this->db->select("payer.*");
        $result = $this->db->get()->row();
        return $result;
    }

    function get_tourist_count ($payer_id, $tour_id)
    {
        $this->db->where("tourist.payer_id", $payer_id);
        $this->db->where("tourist.tour_id", $tour_id);
        $this->db->from("tourist");
        $result = $this->db->get()->result();
        return count($result);
    }

    function update ($payer_id, $tour_id)
    {
        $this->db->where("tour_id", $tour_id);
        $this->db->where("payer_id", $payer_id);
        $this->prepare_variables();
        $this->db->update("payer", $this);
    }

    function insert ($payer_id, $tour_id)
    {
        $insert_array = array(
                "payer_id" => $payer_id,
                "tour_id" => $tour_id
        );
        $query = "INSERT IGNORE INTO `payer` (`payer_id`, `tour_id`) VALUES('$payer_id', '$tour_id');";
        $this->db->query($query);
    }
}<commit_msg>simplify and correct payer_model count tourist function<commit_after><?php
defined('BASEPATH') or exit('No direct script access allowed');

// payer_model.php <NAME> Dec 14, 2013 5:47:05 PM
// <EMAIL>
class Payer_model extends CI_Model
{
    var $payment_type;
    var $room_size;
    var $discount;
    var $amt_paid;
    var $notes;

    function __construct ()
    {
        parent::__construct();
    }

    function prepare_variables ()
    {
        $variables = array(
                "payment_type",
                "room_size",
                "discount",
                "amt_paid",
                "notes"
        );
        for ($i = 0; $i < count($variables); $i ++) {
            $my_variable = $variables[$i];
            if ($this->input->post($my_variable)) {
                if ($my_variable == "discount" || $my_variable == "amt_paid") {
                    $this->$my_variable = format_money($this->input->post($my_variable), "int");
                }
                $this->$my_variable = $this->input->post($my_variable);
            }
        }
    }

    function get_for_tour ($payer_id, $tour_id)
    {
        $this->db->from("payer");
        $this->db->join("tour", "payer.tour_id=tour.id");
        $this->db->join("person", "payer.payer_id=person.id");
        $this->db->where("payer.payer_id", $payer_id);
        $this->db->where("payer.tour_id", $tour_id);
        $this->db->select(
                "tour.tour_name,tour.full_price, tour.banquet_price, tour.early_price, tour.regular_price,tour.single_room, tour.triple_room, tour.quad_room");
        $this->db->select("person.first_name, person.last_name");
        $this->db->select("payer.*");
        $result = $this->db->get()->row();
        return $result;
    }

    function get_tourist_count ($payer_id, $tour_id)
    {
        $this->db->where("tourist.payer_id", $payer_id);
        $this->db->where("tourist.tour_id", $tour_id);
        $this->db->from("tourist");
        $result = $this->db->count_all_results();
        return $result;
    }

    function update ($payer_id, $tour_id)
    {
        $this->db->where("tour_id", $tour_id);
        $this->db->where("payer_id", $payer_id);
        $this->prepare_variables();
        $this->db->update("payer", $this);
    }

    function insert ($payer_id, $tour_id)
    {
        $insert_array = array(
                "payer_id" => $payer_id,
                "tour_id" => $tour_id
        );
        $query = "INSERT IGNORE INTO `payer` (`payer_id`, `tour_id`) VALUES('$payer_id', '$tour_id');";
        $this->db->query($query);
    }
}
{'fraction_non_alphanumeric': 0.17824479470714147, 'fraction_numerical': 0.004670169293636894, 'mean_word_length': 2.208489388264669, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 100, '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': '3378492', 'n_tokens_mistral': 1827, 'n_tokens_neox': 1710, 'n_words': 272}