Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

管理者が自分以外のユーザーアイコンを変更できないバグを修正 #8312

Closed
wants to merge 63 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
cb6c679
管理者が自分以外のユーザーアイコンを変更できないバグを修正
Jan 17, 2025
6f53629
企業研修申し込み一覧表示機能
hagiya0121 Dec 11, 2024
2a07fdc
企業研修申し込み一覧表示のテストを追加
hagiya0121 Dec 13, 2024
04eda1c
企業研修申し込みの詳細ページ
hagiya0121 Dec 16, 2024
cfaf795
企業研修申し込み一覧、個別にデザインを入れた
machida Dec 26, 2024
a8db6cd
テストが通るようにタブに企業研修を追加
hagiya0121 Dec 28, 2024
462984b
企業研修申し込みの個別ページのテストを作成
hagiya0121 Dec 28, 2024
efc0166
不要な空白を削除
hagiya0121 Feb 4, 2025
c4a191a
スキップするプラクティスを動きだけ実装
machida Mar 2, 2024
9881570
スキップするプラクティスの見た目を調整
machida Mar 2, 2024
e8d70aa
スキップするプラクティスの選択をユーザー画面で行うようにした
machida Mar 4, 2024
228737d
スキップするプラクティスのテーブルを追加
kyokucho1989 Mar 16, 2024
42a0b38
slim-lintのエラーを修正
kyokucho1989 Mar 16, 2024
6266498
skip_practiceモデル追加
kyokucho1989 Mar 16, 2024
09cb3f6
skip_practiceモデル用の関連付けとバリデーションを追加
kyokucho1989 Mar 16, 2024
0bf8c5f
skip_practiceのテスト追加
kyokucho1989 Mar 17, 2024
8e080c3
ユーザー登録情報変更画面にスキップするプラクティスの項目追加
kyokucho1989 Mar 23, 2024
02213cd
スキップしたプラクティスのみ一覧ページのデザイン変更
kyokucho1989 May 25, 2024
333777e
プラクティス個別ページにスキップ可否の文面を追加
kyokucho1989 May 25, 2024
52f10b4
ユーザーメモの下に記述
kyokucho1989 May 27, 2024
d9db726
seedデータ追加
kyokucho1989 Jun 2, 2024
cd9fd4f
日報、提出物の再度カラムのユーザー情報の表示を修正、スキップするプラクティスの見た目を整えた
machida Jun 10, 2024
8332638
開閉するコンテンツの高さ制限を付けた
machida Jun 10, 2024
0a9e8e9
:cop:
machida Jun 12, 2024
29aa979
デザイン変更に伴うテストの変更
machida Jun 12, 2024
2439105
デザイン変更に伴うテストの修正
kyokucho1989 Jun 13, 2024
df03c0c
スキップしたプラクティスに関するテスト追加
kyokucho1989 Jun 14, 2024
301f45c
修了数の計算が合うように修正
kyokucho1989 Jun 27, 2024
ada6754
レビューをもとに修正
kyokucho1989 Jul 2, 2024
c1708e1
スキップしたプラクティスの修了ボタンは表示されないように変更
kyokucho1989 Jul 3, 2024
f847fcf
関連付け元の名前修正
kyokucho1989 Jul 11, 2024
f0d68cf
skipするプラクティスのフォーム部分をComponent化
kyokucho1989 Jul 15, 2024
5fa54e2
componentのテスト方法変更
kyokucho1989 Jul 25, 2024
6479e7b
メンター向けプラクティスメモが消えていたので戻した
machida Aug 5, 2024
ce373de
コンフリクト解消で消えたcard-main-actionsの設定を戻した
machida Aug 5, 2024
25d1b4c
SkipPracticeのクラス名変更
kyokucho1989 Aug 7, 2024
f5c2ca5
cateories_with_uniq_practicesメソッドをusermodelのメソッドへ移行
kyokucho1989 Aug 9, 2024
28cd97e
skipped_practice_idsのメソッド名を変更
kyokucho1989 Aug 11, 2024
25a500a
スキップするプラクティスの数を表示する部分をメソッド化
kyokucho1989 Aug 16, 2024
29306dd
使用していないメソッドと変数を削除
kyokucho1989 Aug 19, 2024
1bb272f
変数の宣言箇所をelseの中に移動
kyokucho1989 Aug 30, 2024
97d7da6
practice_ids_skippedメソッドのテストを追加
kyokucho1989 Aug 30, 2024
ceca747
completed_required_practices_size メソッドのテスト追加
kyokucho1989 Sep 4, 2024
c8d3430
userモデルメソッドの一部を新たに別クラスへ移行
kyokucho1989 Sep 23, 2024
cf2e68a
UserPracticeクラスへ移動を検討しているメソッドを追加
kyokucho1989 Sep 29, 2024
87f62e0
作成するClass名変更
kyokucho1989 Oct 2, 2024
a457fda
新規作成したメソッドのテストを追加
kyokucho1989 Oct 7, 2024
e735f4c
userモデルのpracticesメソッドを移行
kyokucho1989 Oct 8, 2024
39e1882
userモデルのスキップするプラクティスのid群のメソッドを移行
kyokucho1989 Oct 9, 2024
8cf4e61
カテゴリの配列を返すメソッドの名前を変更
kyokucho1989 Oct 10, 2024
d4aafdc
カテゴリごとの修了を判定するメソッドを移行
kyokucho1989 Oct 11, 2024
565dbbd
testが通るように修正
kyokucho1989 Oct 12, 2024
8fafa9e
プラクティス一覧の表示位置に関するメソッドを移行
kyokucho1989 Oct 13, 2024
19a4d5e
進捗に対するメソッドを移行
kyokucho1989 Oct 16, 2024
4bbaeb9
進捗率を表示するメソッドを移行
kyokucho1989 Oct 20, 2024
418a2f3
移行元のメソッドとそれに関するテストを削除
kyokucho1989 Nov 5, 2024
f1c02e6
学習期間の表示部分を修正
kyokucho1989 Nov 10, 2024
a4a6857
テストが落ちている原因を修正
kyokucho1989 Nov 20, 2024
324e7d8
インスタンス変数を統一
kyokucho1989 Dec 12, 2024
3a0e758
typo修正と呼ばれてないメソッドをprivateへ移動
kyokucho1989 Dec 14, 2024
0ba10df
testが通るように修正
kyokucho1989 Jan 10, 2025
8a67e49
プラクティス画面の終了条件という誤字を修了条件へ変更(再度)
SuzukiShuntarou Feb 5, 2025
fe11199
管理者が会員のユーザーアイコンを変更できるテストを追加
Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app/components/skipped_practice_component.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- @user_course_practice.categories_for_skip_practice.each do |category|
.skip-practices
input.a-toggle-checkbox(type='checkbox' id="category-#{category}")
.skip-practices__inner
label.skip-practices__header(for='category-#{category}')
.skip-practices__start
.skip-practices__category-name
| #{category.name}
.skip-practices__count
| #{skipped_practices_count(category)}
.skip-practices__end
.skip-practices__category-angle-icon
i.fa-regular.fa-angle-down
.skip-practices__body
= @f.collection_check_boxes :practice_ids, category.practices , :id, :title, include_hidden: false, class: 'label-checkbox' do |b|
.checkboxes
.checkboxes__items
.checkboxes__item.is-sm
= b.check_box(class: 'a-toggle-checkbox')
= b.label { b.text }
19 changes: 19 additions & 0 deletions app/components/skipped_practice_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

class SkippedPracticeComponent < ViewComponent::Base
def initialize(form:, user:)
@f = form
@user = user
@user_course_practice = UserCoursePractice.new(user)
@uniq_practice_ids = @user_course_practice.uniq_practice_ids
end

def skipped_practices_count(category)
if category.practices.empty?
'(0)'
else
skipped_practices_in_category = category.practice_ids & @user_course_practice.skipped_practice_ids
"(#{skipped_practices_in_category.size}/#{category.practices.size})"
end
end
end
13 changes: 13 additions & 0 deletions app/controllers/admin/corporate_training_inquiries_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

class Admin::CorporateTrainingInquiriesController < AdminController
PAGER_NUMBER = 20
def index
per = params[:per] || PAGER_NUMBER
@corporate_training_inquiries = CorporateTrainingInquiry.order(created_at: :desc).page(params[:page]).per(per)
end

def show
@corporate_training_inquiry = CorporateTrainingInquiry.find(params[:id])
end
end
4 changes: 2 additions & 2 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def user_params
:password, :password_confirmation, :job,
:organization, :os, :study_place,
{ experiences: [] }, :company_id,
:trainee, :job_seeking, :nda,
:trainee, :job_seeking, :nda, :avatar,
:graduated_on, :retired_on,
:job_seeker, :github_collaborator,
:officekey_permission, :tag_list, :training_ends_on,
:auto_retire, :invoice_payment, :hide_mentor_profile,
:profile_image, :profile_name, :profile_job, :mentor,
:profile_text, { authored_books_attributes: %i[id title url cover _destroy] },
:country_code, :subdivision_code, discord_profile_attributes: %i[account_name times_url times_id]
:country_code, :subdivision_code, discord_profile_attributes: %i[account_name times_url times_id], practice_ids: []
)
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/courses/practices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def index
.includes(practices: [{ started_students: { avatar_attachment: :blob } }, :learning_minute_statistic, :practices_books])
.order('courses_categories.position')
@learnings = current_user.learnings
@completed_practices_size_by_category = current_user.completed_practices_size_by_category
@completed_practices_size_by_category = @current_user_practice.completed_practices_size_by_category
end
end
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ApplicationController < ActionController::Base
before_action :allow_cross_domain_access
before_action :set_host_for_disk_storage
before_action :require_active_user_login
before_action :set_current_user_practice

protected

Expand Down Expand Up @@ -55,6 +56,10 @@ def require_scheduler_inheritation
head :internal_server_error unless is_a?(SchedulerController)
end

def set_current_user_practice
@current_user_practice = UserCoursePractice.new(current_user)
end

protected

def staging?
Expand Down
1 change: 1 addition & 0 deletions app/controllers/courses/practices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ def index
@course = Course.find(params[:course_id])
@categories = @course.categories.includes(practices: %i[practices_books learning_minute_statistic started_students]).order(:created_at)
@learnings = current_user.learnings
@completed_practices_size_by_category = @current_user_practice.completed_practices_size_by_category
end
end
21 changes: 21 additions & 0 deletions app/decorators/user_course_practice_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

module UserCoursePracticeDecorator
def cached_completed_percentage
Rails.cache.fetch "/model/user_course_practice/#{user.id}/completed_percentage" do
completed_percentage
end
end

def cached_completed_fraction
Rails.cache.fetch "/model/user_course_practice/#{user.id}/completed_fraction" do
"修了: #{completed_practices.size} (必須: #{completed_required_practices.size}/#{required_practices.size})"
end
end

def cached_completed_fraction_in_metas
Rails.cache.fetch "/model/user_course_practice/#{user.id}/completed_fraction_in_metas" do
"#{completed_practices.size} (必須:#{completed_required_practices.size})"
end
end
end
14 changes: 0 additions & 14 deletions app/decorators/user_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ def icon_classes(*classes)
classes.join(' ')
end

def cached_completed_percentage
Rails.cache.fetch "/model/user/#{id}/completed_percentage" do
completed_percentage
end
end

def completed_fraction
"修了: #{completed_practices.size} (必須: #{completed_practices_include_progress_size}/#{practices_include_progress.pluck(:id).uniq.size})"
end

def completed_fraction_in_metas
"#{completed_practices.size} (必須:#{completed_practices_include_progress_size})"
end

def customer_url
"https://dashboard.stripe.com/customers/#{customer_id}"
end
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/Reports.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function Reports({
}

return (
<div className="page-main">
<div className="page-main is-react">
{data.totalPages === 0 && (
<div>
{practices && (
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/UserPracticeProgress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'

export default function UserPracticeProgress({ user }) {
const percentage = user.cached_completed_percentage
const fraction = user.completed_fraction
const fraction = user.cached_completed_fraction

const roundedPercentage = user.graduated_on
? '100%'
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/user-practice-progress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
data() {
return {
percentage: this.user.cached_completed_percentage,
fraction: this.user.completed_fraction
fraction: this.user.cached_completed_fraction
}
},
computed: {
Expand Down
1 change: 1 addition & 0 deletions app/javascript/stylesheets/application.sass
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@import application/blocks/auth-form/auth-form-nav
@import application/blocks/auth-form/auth-form
@import application/blocks/auth-form/next-settlement-time
@import application/blocks/auth-form/skip-practices

@import application/blocks/cards/card-counts

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.skip-practices
.skip-practices + &
margin-top: .5rem

.skip-practices__inner
border-radius: .25rem
border: solid 1px var(--border)
overflow: hidden
transition: all .2s ease-out
input:checked + &
border-color: var(--primary)

.skip-practices__header
display: flex
justify-content: space-between
height: 2.5rem
+text-block(.875rem 1.5)
padding: .75rem
align-items: center
cursor: pointer
color: var(--semi-muted-text)
transition: all .2s ease-out
&:hover
background-color: var(--background)
input:checked + .skip-practices__inner &
background-color: var(--primary-tint)
color: var(--primary-text)

.skip-practices__category-angle-icon
transition: all .2s ease-out
input:checked + .skip-practices__inner &
transform: rotate(180deg)

.skip-practices__category-name
transition: all .2s ease-out
.skip-practices__header:hover &
text-decoration: underline
color: var(--default-text)

.skip-practices__start
display: flex
gap: .25rem

.skip-practices__body
transition: all .2s ease-out
display: none
border-top: solid 1px var(--primary-semi-tint)
margin-top: -1px
padding: .75rem
font-size: .8125rem
background-color: var(--primary-tint)
input:checked + .skip-practices__inner &
display: block
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
word-break: break-all
&.is-wip
color: var(--muted-text)
&.is-skip-on
color: var(--muted-text)
.a-title-label
display: inline-flex
vertical-align: top
Expand Down Expand Up @@ -168,3 +170,12 @@
+media-breakpoint-down(sm)
+size(3.5rem)
+position(absolute, right 0, top 0)

.page-content-header__alert
background-color: var(--danger-tint)
color: var(--danger-text)
+text-block(.875rem 1.4)
text-align: center
padding: .5rem 1rem
border: solid 1px var(--danger)
border-radius: .25rem
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
padding: .5rem .75rem .75rem
&.sortable-chosen
background-color: tint($warning, 90%)
&.is-skip-on
background-color: var(--background-tint)
&[draggable="false"]
background-color: var(--base)
animation: grab-background-color 1.25s ease 0s 1 normal none running
Expand Down Expand Up @@ -52,6 +54,8 @@
font-size: .8125rem
.a-badge
margin-right: .25rem
&.is-skip-on
color: var(--muted-text)

.category-practices-item__title-link-label
a.category-practices-item__title-link:hover &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,65 +17,26 @@
display: none
.a-card
border-top-left-radius: 0
.user-info + .a-card
border-top-right-radius: 0
max-height: 76vh
overflow-y: auto
.card-header
display: none
.card-header + [class*=a-border]
display: none
.card-body
max-height: calc(100vh - 181px)
overflow-y: auto
.user-info + .a-card .card-body
max-height: calc(100vh - 330px)
.user-info
padding: 1rem
background-color: var(--base)
border: solid 1px var(--border)
border-bottom: none
max-height: 13rem
overflow: auto
.user-metas
margin-top: 0
& + .user-metas
margin-top: -1px
.user-metas__title
padding: .25rem .5rem
font-size: .625rem
background-color: var(--background)
.user-metas__items
padding: .25rem .5rem
font-size: .75rem
.user-metas__item
display: inline
+text-block(.75rem 1.6)
padding: 0
border: none
&:not(:last-child)::after
content: '、'
.user-metas__item:not(:last-child)
border: none
.user-metas__item:nth-child(even)
background-color: var(--base)
.user-metas__item-label,
.user-metas__item-value
padding: 0
display: inline
+media-breakpoint-down(sm)
border: none
ul,
li
margin-left: 0
display: inline
li:not(:last-child)::after
content: '・'
border: solid 1px var(--border)
margin: -1px
.user-metas__item-label
border-right: none
flex: 0 0 auto
&::after
content: ':'
margin-inline: .125rem
.form-tabs
margin-bottom: 0
flex: 0 0 9rem
.a-markdown-input
padding-inline: 0
.a-long-text
Expand Down
6 changes: 5 additions & 1 deletion app/javascript/stylesheets/atoms/_a-card.sass
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
margin-inline: 1rem
&.is-toggle
label
cursor: pointer
cursor: pointer
> input:not(:checked) + * + *
display: none
> input:not(:checked) + *
Expand All @@ -45,6 +45,10 @@
display: none
> input:checked + * .is-hidden-then-checked
display: none
.card-body
max-height: 50vh
overflow-y: auto


table.a-card
display: table
Expand Down
8 changes: 8 additions & 0 deletions app/javascript/stylesheets/config/mixins/_practice-color.sass
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
+practice-button($success, $border)
color: var(--reversal-text)
&.is-unstarted
+practice-button(#fff)
color: var(--muted-text)
border: solid 1px var(--border)
&.is-active
color: var(--default-text)
border-color: var(--defaut-text)
background-color: var(--background-tint)
&.is-skip-on
+practice-button(#dcdcdc, $border)
color: var(--muted-text)
@if $border == true
Expand Down
Loading