タスクカウンタV 20更新


私は私のタスクカウンタプロジェクトと私の前のポストで提供される提案のおかげで更新しました:
これが結果です.
私はhttps://fontawesome.com/から私のプロジェクトの外観を整理し、ボーナスポイントのための活動タイプフィールドを追加するアイコンを追加しました.


そして、あなたがどのように私がそれらの緑のチェックマークを置くかについて疑問に思っているならば、チェックしてください' s大ポスト:
今、ボーナスポイントは、活動の種類を選択して達成することができます.

各タイプのボーナスポイント:
他の、+ 5ポイント
  • の経歴、+ 25ポイント
  • 以前のタイプ以外の何でも、+ 15ポイント
  • 以下がコードです.
    public function index(Request $request)
        {
            $acts = DB::table('activities')->orderBy('id')->cursorPaginate(10);
    
            $counter = DB::table('activities')
                ->select(DB::raw('SUM(time * rating) AS point'))
                ->first();
    
            //collecting bonus point from activity with Career type
            $bonus_career= DB::table('activities')
                ->select(DB::raw('COUNT(type)*25 AS point'))
                ->where('type', "Career")
                ->first();
    
            //collecting bonus point from activity other than Career and other type
            $bonus_else= DB::table('activities')
                ->select(DB::raw('COUNT(type)*15 AS point'))
                ->where('type','!=',"Career")
                ->where('type','!=',"Other")
                ->first();
    
            //collecting bonus point from activity with Other type
            $bonus_other= DB::table('activities')
                ->select(DB::raw('COUNT(type)*5 AS point'))
                ->where('type', "Other")
                ->first();
    
            //sum all collected point + bonus point
            $allPoints=$counter->point+$bonus_career->point+$bonus_else->point+$bonus_other->point;
    
            if($allPoints<1000){
                $request->session()->put('quote', "You're just started, let's go!");
            }else if($allPoints<2000){
                $request->session()->put('quote', "Not bad, for a newbie!");
            }else if($allPoints<4000){
                $request->session()->put('quote', "Nice, keep it up!");
            }else if($allPoints<8000){
                $request->session()->put('quote', "You're pretty good, don't get cocky though!");
            }else if($allPoints<16000){
                $request->session()->put('quote', "Great job, what a chad!");
            }else if($allPoints<32000){
                $request->session()->put('quote', "Excellent, your highness!");
            }else if($allPoints>=100000){
                $request->session()->put('quote', "You're a God!");
            }
    
            $request->session()->put('point', $allPoints);
            return view('activities',['acts'=>$acts]);
        }
    
    それで、allallpointsのための公式:
    合計(時間*評価)+収集ボーナスポイント
    はい.コードは方法を簡略化され、それを見て傷つける.あなたがどれほどコードを単純化するかについてわかっているならば、コメントで知らせてください.
    そして、それは私が働いている更新プログラムです.たとえプロジェクトの外観が少し不足しているとしても、何かをデザインするのがあまり得意ではないからです.私は、フロントエンドガイより後ろの終わり人です.
    場合は、タスクカウンタの任意の開発のアイデアを、私に知らせてください.