<commit_before><?php
  use_helper('Widgets');
  $sf_request->setParameter('_homeFooter', true);

  // optimze?
  // $carddata = ReviewsPeer::getLeitnerBoxCounts($this->filter);
  // $this->restudy_cards = $carddata[0]['expired_cards'];

  // alias template vars here, in case this becomes a Vue comp. someday
  $rtk = rtkIndex::inst();
  $studyPos = $progress->heisignum ?: 1;
  $studyMax = rtkIndex::inst()->getNumCharactersVol1();
  $studyLesson = $progress->curlesson ?: 1;
  $studyLessonMax = rtkIndex::inst()->getCharCountForLesson($studyLesson);
  $studyLessonPos = $studyLessonMax - $progress->kanjitogo;

  // FIXME - shows Restudy across ALL cards - not just current sequence
  $restudyCount = ReviewsPeer::getRestudyKanjiCount($sf_user->getUserId());

  // number of lessons in current sequence
  $numLessons = rtkIndex::inst()->getNumLessonsVol1();

  // count of flashcards part of current  sequence
  $flashcardCount = ReviewsPeer::getFlashcardCount($sf_user->getUserId(), 'rtk1');

  // is the SRS active? (*ANY* flashcards, not just current sequence)
  $hasFlashcards = ReviewsPeer::getFlashcardCount($sf_user->getUserId());
  $countSrsNew = $hasFlashcards ? ReviewsPeer::getCountUntested($sf_user->getUserId()) : 0;
  $countSrsDue = $hasFlashcards ? ReviewsPeer::getCountExpired($sf_user->getUserId()) : 0;

  $urls = [
    'new' => url_for_review(['type' => 'untested']),
    'due' => url_for_review(['type' => 'expired']),
  ];

// DBG::user();
?>

<h2>Welcome back, <?= $sf_user->getUserName(); ?>!</h2>

<div class="row mb-5">
  <div class="col-md-6 md:mb-0">
    <div class="ko-Box ko-DashBox">
      <h3 class="ko-DashBox-title">Study</h3>

      <div class="text-smx mb-4">
        <strong><?= $flashcardCount; ?></strong> / <?= $studyMax; ?> kanji in <strong><?= $rtk->getSequenceName(); ?></strong>
        <?= link_to('Change', 'account/sequence', ['class' => 'ml-2']); ?>
      </div>

      <div class="ko-PctBar mb-4">
        27%
      </div>

      <div>
<?= _bs_button('Study Kanji #1<i class="fa fa-book-open ml-2"></i>', 'study/index', ['class' => 'ko-Btn ko-Btn--success ko-Btn--large']); ?>
<?php
  if ($restudyCount)
  {
    echo _bs_button(
      "Restudy List ( {$restudyCount} )".'<i class="fa fa-book-open ml-2"></i>',
      'study/failedlist',
      [
        'class' => 'ko-Btn ko-Btn--danger ko-Btn--large ml-4',
      ]
    );
  }
?>
      </div>

    </div>
  </div>

  <div class="col-md-6 md:mb-0">
    <div class="ko-Box ko-DashBox h-full">
      <h3 class="ko-DashBox-title">Review</h3>

<?php if ($hasFlashcards): ?>
      <div class="flex items-stretch -ml-2">
        <a class="ko-Dash-srsIcoBtn is-new flex items-center" href="<?= $urls['new']; ?>">
          <div class="ko-Dash-srsIso is-new"><em class="is-top"></em><em class="is-side"></em></div>
          <span class="ml-2"><?= $countSrsNew; ?> <strong>new</strong></span>
        </a>

        <a class="ko-Dash-srsIcoBtn is-due flex items-center ml-2" href="<?= $urls['due']; ?>">
          <div class="ko-Dash-srsIso is-due"><em class="is-top"></em><em class="is-side"></em></div>
          <span class="ml-2"><?= $countSrsDue; ?> <strong>due</strong></span>
        </a>

        <?= _bs_button(
  'Spaced Repetition'.'<i class="fa fa-arrow-right ml-2"></i>',
  '@overview',
  [
    'class' => 'ko-Btn ko-Btn--primary ko-Btn--large ml-auto',
  ]<commit_msg>Add titles to the new/due review links<commit_after><?php
  use_helper('Widgets');
  $sf_request->setParameter('_homeFooter', true);

  // optimze?
  // $carddata = ReviewsPeer::getLeitnerBoxCounts($this->filter);
  // $this->restudy_cards = $carddata[0]['expired_cards'];

  // alias template vars here, in case this becomes a Vue comp. someday
  $rtk = rtkIndex::inst();
  $studyPos = $progress->heisignum ?: 1;
  $studyMax = rtkIndex::inst()->getNumCharactersVol1();
  $studyLesson = $progress->curlesson ?: 1;
  $studyLessonMax = rtkIndex::inst()->getCharCountForLesson($studyLesson);
  $studyLessonPos = $studyLessonMax - $progress->kanjitogo;

  // FIXME - shows Restudy across ALL cards - not just current sequence
  $restudyCount = ReviewsPeer::getRestudyKanjiCount($sf_user->getUserId());

  // number of lessons in current sequence
  $numLessons = rtkIndex::inst()->getNumLessonsVol1();

  // count of flashcards part of current  sequence
  $flashcardCount = ReviewsPeer::getFlashcardCount($sf_user->getUserId(), 'rtk1');

  // is the SRS active? (*ANY* flashcards, not just current sequence)
  $hasFlashcards = ReviewsPeer::getFlashcardCount($sf_user->getUserId());
  $countSrsNew = $hasFlashcards ? ReviewsPeer::getCountUntested($sf_user->getUserId()) : 0;
  $countSrsDue = $hasFlashcards ? ReviewsPeer::getCountExpired($sf_user->getUserId()) : 0;

  $urls = [
    'new' => url_for_review(['type' => 'untested']),
    'due' => url_for_review(['type' => 'expired']),
  ];

// DBG::user();
?>

<h2>Welcome back, <?= $sf_user->getUserName(); ?>!</h2>

<div class="row mb-5">
  <div class="col-md-6 md:mb-0">
    <div class="ko-Box ko-DashBox">
      <h3 class="ko-DashBox-title">Study</h3>

      <div class="text-smx mb-4">
        <strong><?= $flashcardCount; ?></strong> / <?= $studyMax; ?> kanji in <strong><?= $rtk->getSequenceName(); ?></strong>
        <?= link_to('Change', 'account/sequence', ['class' => 'ml-2']); ?>
      </div>

      <div class="ko-PctBar mb-4">
        27%
      </div>

      <div>
<?= _bs_button('Study Kanji #1<i class="fa fa-book-open ml-2"></i>', 'study/index', ['class' => 'ko-Btn ko-Btn--success ko-Btn--large']); ?>
<?php
  if ($restudyCount)
  {
    echo _bs_button(
      "Restudy List ( {$restudyCount} )".'<i class="fa fa-book-open ml-2"></i>',
      'study/failedlist',
      [
        'class' => 'ko-Btn ko-Btn--danger ko-Btn--large ml-4',
      ]
    );
  }
?>
      </div>

    </div>
  </div>

  <div class="col-md-6 md:mb-0">
    <div class="ko-Box ko-DashBox h-full">
      <h3 class="ko-DashBox-title">Review</h3>

<?php if ($hasFlashcards): ?>
      <div class="flex items-stretch -ml-2">
        <a class="ko-Dash-srsIcoBtn is-new flex items-center" href="<?= $urls['new']; ?>" title="Review new kanji cards">
          <div class="ko-Dash-srsIso is-new"><em class="is-top"></em><em class="is-side"></em></div>
          <span class="ml-2"><?= $countSrsNew; ?> <strong>new</strong></span>
        </a>

        <a class="ko-Dash-srsIcoBtn is-due flex items-center ml-2" href="<?= $urls['due']; ?>" title="Review due kanji cards">
          <div class="ko-Dash-srsIso is-due"><em class="is-top"></em><em class="is-side"></em></div>
          <span class="ml-2"><?= $countSrsDue; ?> <strong>due</strong></span>
        </a>

        <?= _bs_button(
  'Spaced Repetition'.'<i class="fa fa-arrow-right ml-2"></i>',
  '@overview',
  [
    'class' => 'ko-Btn ko-Btn--primary ko-Btn--large ml-auto',
  ]
{'fraction_non_alphanumeric': 0.2127690730707278, 'fraction_numerical': 0.00966466539756919, 'mean_word_length': 3.517195767195767, 'pattern_counts': {'":': 0, '<': 139, '<?xml version=': 0, '>': 185, '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': '6983243', 'n_tokens_mistral': 2575, 'n_tokens_neox': 2523, 'n_words': 468}