Example #1
0
    <div class="ui four column center aligned divided relaxed stackable grid container">
      <div class="row">
        <div class="column">
          <div class="ui green segment">이 문제는 어때요?</div>
          <?php 
$randProblem = ProblemService::getOpenProblems();
$hasProblem = $randProblem->count() > 0;
if ($hasProblem) {
    $randProblem = $randProblem->random();
    $ac = $randProblem->problemStatisticses->first() ? $randProblem->problemStatisticses->first()->count : 0;
    $sc = $randProblem->total_submit;
} else {
    $ac = 0;
    $sc = 0;
}
$rate = number_format(StatisticsService::getRate($ac, $sc), 2);
?>
          @if( $hasProblem )
          <div class="ui card">
            @if( Sentinel::check() )
              {{-- 맞은 문제가 안나오고 전체 문제가 카운팅 되고 있음 --}}
              @if( ($uac = $randProblem->statisticses->first()? $randProblem->statisticses->first()->count: -1) > 0 )
              <div class="extra content">
                <i class="check icon"></i>
                해결한 문제입니다!
              </div>
              @elseif( $uac == 0 )
              <div class="extra content">
                <i class="notched circle loading icon"></i>
                도전 중인 문제입니다!
              </div>
 public function getTypeByKey($key)
 {
     $types = StatisticsService::getTypes();
     if (is_numeric($key)) {
         return isset($types[$key]) ? $key : false;
     } else {
         return array_search($key, $types);
     }
 }