# frozen_string_literal: true class ReviewsController < ApplicationController def show @review = Review.due.includes(:word).first @due_count = Review.due.count @upcoming = Review.upcoming.includes(:word).limit(5) @upcoming_count = Review.upcoming.count end def rate review = Review.find(params[:id]) quality = case params[:rating] when "easy" then 5 when "good" then 4 when "hard" then 3 when "forgot" then 1 else params[:quality].to_i end review.sm2_update!(quality) redirect_to review_path end end