<commit_before><?php

class DegustationClient extends acCouchdbClient {

    const TYPE_MODEL = "Degustation";
    const TYPE_COUCHDB = "DEGUSTATION";
    const SPECIFICITE_PASSAGES = "Xème passage";

    public static function getInstance()
    {
        return acCouchdbManager::getClient("Degustation");
    }

    public static function updatedSpecificite($lot) {
      $nb = 2;
      if (preg_match("/.*([0-9]+)".str_replace('X', '', self::SPECIFICITE_PASSAGES).".*/", $lot->specificite, $m)) {
        $nb = ((int)$m[1]) + 1;
      }
      if (preg_match("/^".self::TYPE_COUCHDB."/", $lot->id_document)) {
        $lot->specificite = ($lot->specificite)? $lot->specificite.', '.str_replace('X', $nb, self::SPECIFICITE_PASSAGES) : str_replace('X', $nb, self::SPECIFICITE_PASSAGES);
      }
      return $lot;
    }

    public function find($id, $hydrate = self::HYDRATE_DOCUMENT, $force_return_ls = false) {
        $doc = parent::find($id, $hydrate, $force_return_ls);
        if($doc && $doc->type != self::TYPE_MODEL) {
            throw new sfException(sprintf("Document \"%s\" is not type of \"%s\"", $id, self::TYPE_MODEL));
        }
        return $doc;
    }

    public function getHistory($limit = 10, $hydrate = acCouchdbClient::HYDRATE_DOCUMENT) {
        $res = $this->getAllDocsByType(self::TYPE_COUCHDB, $limit);
        $objects = array();
        foreach($res->rows as $row) {
            $objects[] = $this->find($row->id, $hydrate);
        }
        return $objects;
    }

    public static function getNumeroTableStr($numero_table){
      $alphas = range('A', 'Z');
      return $alphas[$numero_table-1];
    }

    public function getManquements() {
        $manquements = array();
        foreach (MouvementLotView::getInstance()->getByStatut(null, Lot::STATUT_NONCONFORME)->rows as $item) {
            $manquements[Lot::generateMvtKey($item->value)] = $item->value;
        }
        return $manquements;
    }

}
<commit_msg>Historique des dégustations en ordre décroissant<commit_after><?php

class DegustationClient extends acCouchdbClient {

    const TYPE_MODEL = "Degustation";
    const TYPE_COUCHDB = "DEGUSTATION";
    const SPECIFICITE_PASSAGES = "Xème passage";

    public static function getInstance()
    {
        return acCouchdbManager::getClient("Degustation");
    }

    public static function updatedSpecificite($lot) {
      $nb = 2;
      if (preg_match("/.*([0-9]+)".str_replace('X', '', self::SPECIFICITE_PASSAGES).".*/", $lot->specificite, $m)) {
        $nb = ((int)$m[1]) + 1;
      }
      if (preg_match("/^".self::TYPE_COUCHDB."/", $lot->id_document)) {
        $lot->specificite = ($lot->specificite)? $lot->specificite.', '.str_replace('X', $nb, self::SPECIFICITE_PASSAGES) : str_replace('X', $nb, self::SPECIFICITE_PASSAGES);
      }
      return $lot;
    }

    public function find($id, $hydrate = self::HYDRATE_DOCUMENT, $force_return_ls = false) {
        $doc = parent::find($id, $hydrate, $force_return_ls);
        if($doc && $doc->type != self::TYPE_MODEL) {
            throw new sfException(sprintf("Document \"%s\" is not type of \"%s\"", $id, self::TYPE_MODEL));
        }
        return $doc;
    }

    public function getHistory($limit = 10, $hydrate = acCouchdbClient::HYDRATE_DOCUMENT) {

        return $this->startkey(self::TYPE_COUCHDB."Z")->endkey(self::TYPE_COUCHDB)->descending(true)->limit($limit)->execute($hydrate);
    }

    public static function getNumeroTableStr($numero_table){
      $alphas = range('A', 'Z');
      return $alphas[$numero_table-1];
    }

    public function getManquements() {
        $manquements = array();
        foreach (MouvementLotView::getInstance()->getByStatut(null, Lot::STATUT_NONCONFORME)->rows as $item) {
            $manquements[Lot::generateMvtKey($item->value)] = $item->value;
        }
        return $manquements;
    }

}

{'fraction_non_alphanumeric': 0.16852187419104322, 'fraction_numerical': 0.0041418586590732595, 'mean_word_length': 3.2508250825082508, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 32, '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': '423885', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1288, 'n_words': 230}