<commit_before><?php

/**
 * default actions.
 *
 * @package    followben
 * @subpackage default
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class defaultActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request) {
    $this->tweets = Doctrine::getTable('Tweet')->getLatestKeywords(array('le2jog', 'justgiving'), sfConfig::get('app_twitter_display'));
  }

  public function executeRoute(sfWebRequest $request) {
    if ($request->hasParameter('date')) {
      $date = strtotime($request->getParameter('date'));
    } else {
      $date = time();
    }

    $q = Doctrine::getTable('Position')->createQuery('p');
    $q->where('p.timestamp BETWEEN ? AND ?', array(mktime(0,0,0, date('n', $date), date('j', $date), date('Y', $date)), mktime(23,59,0, date('n'), date('j'), date('Y'))));
    $q->addOrderBy('p.timestamp');
    $this->points = $q->execute();
  }
}<commit_msg>Show last point when no points for today<commit_after><?php

/**
 * default actions.
 *
 * @package    followben
 * @subpackage default
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class defaultActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request) {
    $this->tweets = Doctrine::getTable('Tweet')->getLatestKeywords(array('le2jog', 'justgiving'), sfConfig::get('app_twitter_display'));
  }

  public function executeRoute(sfWebRequest $request) {
    if ($request->hasParameter('date')) {
      $date = strtotime($request->getParameter('date'));
    } else {
      $date = time();
    }

    $q = Doctrine::getTable('Position')->createQuery('p');
    $q->where('p.timestamp BETWEEN ? AND ?', array(mktime(0,0,0, date('n', $date), date('j', $date), date('Y', $date)), mktime(23,59,0, date('n'), date('j'), date('Y'))));
    $q->addOrderBy('p.timestamp');
    $this->points = $q->execute();

    if ($this->points->count()==0) {
      $q = Doctrine::getTable('Position')->createQuery('p');
      $q->limit(1);
      $q->orderBy('p.timestamp DESC');
      $this->points = $q->execute();
    }

  }
}
{'fraction_non_alphanumeric': 0.19812526629740093, 'fraction_numerical': 0.024712398806987643, 'mean_word_length': 4.027837259100642, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '976334', 'n_tokens_mistral': 824, 'n_tokens_neox': 780, 'n_words': 156}