-
Notifications
You must be signed in to change notification settings - Fork 72
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
キャンペーン名を動的に表示する #4228
Merged
komagata
merged 11 commits into
main
from
feature/display-the-campaign-name-dynamically
Mar 10, 2022
Merged
キャンペーン名を動的に表示する #4228
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
961da1d
キャンペーン名を動的に表示する
ot0m1 f4d921f
キャンペーン名を動的に取得し反映
ot0m1 7e908dc
rubocop通した
ot0m1 1ff8bb4
クラスメソッドをまとめた
ot0m1 9780140
メソッド名を文法的に正しく修正
ot0m1 f942ccc
rubocopがサジェストするメソッド名に変更
ot0m1 a1e4074
テストが通るよう古いメソッド名の箇所を変更
ot0m1 6b496a5
最新の origin/main を取り込み
ot0m1 2421c5e
不要な return 文を削除
ot0m1 0fa9432
return if を復活
ot0m1 6288731
不要なスペースを削除
ot0m1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,17 +12,25 @@ class Campaign < ApplicationRecord | |
validate :end_at_be_greater_than_start_at | ||
end | ||
|
||
def self.recently_campaign | ||
campaign = Campaign.order(end_at: :desc).first | ||
return if campaign.nil? | ||
class << self | ||
def recently_campaign | ||
campaign = Campaign.order(end_at: :desc).first | ||
return if campaign.nil? | ||
|
||
campaign.start_at..campaign.end_at | ||
end | ||
campaign.start_at..campaign.end_at | ||
end | ||
|
||
def today_campaign? | ||
return if recently_campaign.nil? | ||
|
||
recently_campaign.cover?(Time.current) | ||
end | ||
|
||
def self.today_is_campaign? | ||
return if recently_campaign.nil? | ||
def current_title | ||
return unless today_campaign? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. メソッド名素晴らしいです〜! これってメソッドの定義はどこでかわっていますか?(今回のdiffの中に見当たらないので) |
||
|
||
recently_campaign.cover?(Time.current) | ||
Campaign.order(end_at: :desc).first.title | ||
end | ||
end | ||
|
||
private | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この
if
は不要かもと思いました〜。