Reviewed-on: #357 Co-authored-by: miteruzo <miteruzo@naver.com> Co-committed-by: miteruzo <miteruzo@naver.com>
このコミットはPull リクエスト #357 でマージされました.
このコミットが含まれているのは:
@@ -0,0 +1,29 @@
|
||||
class TheatrePostAdvancer
|
||||
def self.call(theatre:)
|
||||
new(theatre:).call
|
||||
end
|
||||
|
||||
def initialize(theatre:)
|
||||
@theatre = theatre
|
||||
end
|
||||
|
||||
def call
|
||||
previous_post = theatre.current_post
|
||||
post = TheatrePostSelector.new(theatre:).select
|
||||
|
||||
TheatreSkipVote.where(theatre:, post: previous_post).delete_all if previous_post
|
||||
|
||||
theatre.update!(current_post: post, current_post_started_at: post ? Time.current : nil)
|
||||
|
||||
if post
|
||||
position = (theatre.programmes.maximum(:position) || 0) + 1
|
||||
theatre.programmes.create!(position:, post:)
|
||||
end
|
||||
|
||||
post
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :theatre
|
||||
end
|
||||
新しい課題から参照
ユーザをブロックする