命名規則の統一: practice/session → lesson/lesson_record#64
Merged
Conversation
## 変更内容 ### データベース - テーブル名: typing_sessions → lesson_records - マイグレーション: RenameTypingSessionsToLessonRecords ### モデル - TypingSession → LessonRecord にリネーム - User モデルの関連付けを更新(has_many :lesson_records) - メソッド名を統一(cleanup_old_typing_sessions → cleanup_old_lesson_records) ### コントローラ・ビュー・ルーティング - PracticesController → LessonsController にリネーム - URL: /practices/:id → /lessons/:id に変更 - 301リダイレクト設定(旧URLから新URLへ) - ビューディレクトリ: app/views/practices → app/views/lessons ### My::HistoryController - @sessions → @lesson_records に統一 - session_params → lesson_record_params に変更 - JSON API のキー名を lesson_record に変更 ### Admin ダッシュボード - @total_typing_sessions → @total_lesson_records - @sessions_today → @records_today - @sessions_this_week → @records_this_week - @recent_sessions → @recent_records - すべてのビューで変数名を統一 ### JavaScript - typing_controller.js で lesson_record パラメータに変更 - 履歴保存APIのリクエストボディを更新 ## 目的 - 認証の session との混同を回避(TypingSession vs session[:user_id]) - practice と lesson の混在を解消(URL は practice、データは lesson だった) - 日本語UIとの一貫性(「レッスン」= lesson) - DB、モデル、コントローラ、View、JavaScript すべてで統一 ## チェック項目 - ✅ Rubocop: 60 files inspected, no offenses detected - ✅ Brakeman: No warnings found - ✅ マイグレーション実行成功 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- get_practice_items → get_lesson_items (LessonLoader) - PracticeHelper → LessonHelper (モジュール名) - practiceScreenTarget → lessonScreenTarget (Stimulus) - word_practice → word_lessons (YAMLキー) - sentence_practice → sentence_lessons (YAMLキー) - practice_sample.png → lesson_sample.png (画像ファイル) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Admin Dashboardの人気レッスンランキングで使用している SQLのエイリアス名を統一。 - COUNT(*) as practice_count → COUNT(*) as lesson_count - ORDER BY practice_count → ORDER BY lesson_count - ビューでの参照も lesson.lesson_count に統一 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
タイピングセッション関連の変数・メソッド名を変更: - sessionStartTime → lessonStartTime - restartSession() → restartLesson() - コメントも「セッション」→「レッスン」に統一 これにより、ログインセッションとの混同を完全に解消。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
命名規則の一貫性向上のため、以下のリファクタリングを実施しました。
変更内容
1. URL・コントローラ・ビュー
/practices/:id→/lessons/:id(301リダイレクト設定済み)PracticesController→LessonsControllerapp/views/practices/→app/views/lessons/2. モデル・DB
TypingSession→LessonRecordtyping_sessionsテーブル →lesson_recordsテーブルsession[:user_id])との混同を解消3. 変数名・メソッド名の統一
@sessions→@lesson_records(全コントローラ・ビュー)session_params→lesson_record_paramsget_practice_items→get_lesson_itemssessionStartTime→lessonStartTimerestartSession→restartLesson4. その他
session:→lesson_record:practiceScreen→lessonScreenPracticeHelper→LessonHelperword_practice/sentence_practice→word_lessons/sentence_lessonspractice_sample.png→lesson_sample.pngpractice_count→lesson_count理由
lessonを多用(lesson_id,LessonLoaderなど)sessionの混同を解消(ログインセッション vs 練習記録)テスト結果
影響範囲
コミット構成
8dfc054- 基本的なリネーム(テーブル、モデル、コントローラ、ビュー)bb5d451- 追加のpractice参照(メソッド名、Helper、Stimulus、YAML、画像)f1096f6- SQLエイリアス(practice_count → lesson_count)7a2ad2c- JavaScriptのsession参照(sessionStartTime、restartSession)🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com