From b32fe3ce86b3a3d01615b5194249e60179f3f0c0 Mon Sep 17 00:00:00 2001 From: pvincent Date: Mon, 17 Jun 2024 16:46:21 +0400 Subject: [PATCH] git blame --- .vscode/extensions.json | 3 +- app/controllers/scores_controller.rb | 49 +--------------------------- 2 files changed, 3 insertions(+), 49 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 1dd6141..b05a8cb 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,6 +5,7 @@ "yzhang.markdown-all-in-one", "jgclark.vscode-todo-highlight", "bradlc.vscode-tailwindcss", - "aliariff.vscode-erb-beautify" + "aliariff.vscode-erb-beautify", + "waderyan.gitblame" ] } \ No newline at end of file diff --git a/app/controllers/scores_controller.rb b/app/controllers/scores_controller.rb index 7d45ff3..5ca0b43 100644 --- a/app/controllers/scores_controller.rb +++ b/app/controllers/scores_controller.rb @@ -1,61 +1,20 @@ # ScoresController define Score and Grade interactions class ScoresController < ApplicationController include Pagy::Backend - include AnsiColors before_action :set_score, only: %i[show edit update destroy] - def grayshade(n) - shade = eval("TEXT_GRAY_#{n}") - shade += n.to_s - end - # GET /scores def index @pagy, @scores = pagy(Score.all) - - # logger.debug 'this is a debug message' - # logger.info 'this is a super long message which should be wrapped. ' * 5 - shades = [800, 700, 600, 500, 400, 300, 200, 100].map { |n| grayshade(n) }.join(' ') - - logger.info(BG_BLACK + shades) - logger.info(BG_GRAY + shades) - logger.info(BG_WHITE + shades) - logger.info(BG_BLACK + TEXT_GRAY_200 + "this is #{BOLD}a message in bold#{CLEAR}#{TEXT_GRAY_200}, isnt'it?") - logger.info(BG_BLACK + TEXT_GRAY_200 + "this is #{TEXT_WHITE}a message in bold#{CLEAR}#{TEXT_GRAY_200}, isnt'it?") - logger.info(BG_BLACK + TEXT_GRAY_200 + "this is #{BOLD}#{TEXT_WHITE}a message in bold#{CLEAR}#{TEXT_GRAY_200}, isnt'it?") - logger.info(BG_GRAY + TEXT_GRAY_200 + "this is #{BOLD}a message in bold#{CLEAR}#{TEXT_GRAY_200}, isnt'it?") - logger.info(BG_WHITE + TEXT_GRAY_800 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") - logger.info(BG_WHITE + TEXT_GRAY_600 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") - logger.info(BG_WHITE + TEXT_GRAY_400 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") - logger.info(BG_WHITE + TEXT_GRAY_300 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") - logger.info(BG_WHITE + TEXT_GRAY_200 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") - logger.info(BG_WHITE + TEXT_GRAY_100 + "this is #{BOLD}a message in bold#{CLEAR}, isnt'it?") - - logger.info({ one: 1, two: 2 }) - logger.info 'this is an information', { four: 4, five: 5 } - logger.debug BigDecimal('0.0003') - logger.warn 'scores are', @scores - logger.warn "this is a #{BOLD}warning#{CLEAR}#{BG_YELLOW}#{TEXT_BLACK}\n yop\n cool" - logger.warn "this is a warning\n yop\n cool" - logger.error 'this is an error message' - logger.error "error message line #1\nerror message line #2\nerror message line #3\n\n" - logger.info 'end of normal message' - logger.debug @scores - # sleep 0.5 end # GET /scores/1 - def show - # logger.info(Rails.application.routes.url_helpers.root_url) - end + def show; end # GET /scores/new def new @score = Score.new - flash.now[:notice] = 'Unique name is mandatory!' - flash.now[:alert] = 'Your book was not found' - sleep 0.3 end # GET /scores/1/edit @@ -83,18 +42,12 @@ class ScoresController < ApplicationController # DELETE /scores/1 def destroy - do_an_exception - @score.destroy! redirect_to scores_url, notice: 'Score was successfully destroyed.', status: :see_other end private - def do_an_exception - raise 'Unable to destroy this score. ' * 5 - end - # Use callbacks to share common setup or constraints between actions. def set_score @score = Score.find(params[:id])