Skip to content

Commit

Permalink
Merge pull request #145 from true-runes/development
Browse files Browse the repository at this point in the history
v4.2.2
  • Loading branch information
nikukyugamer authored Jun 13, 2021
2 parents a1d7e52 + b2af010 commit 6a03db5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,14 @@ def target_tweets(hashtag, options={})
)
end

# tweetd_at のみの ORDER_BY では秒単位で一致する可能性があるので、id_number も用いる(id_number だけでもいい)
active_record_relation.where(
id_number: beginning_search_tweet_id_number..
).order(tweeted_at: :asc)
).order(
tweeted_at: :asc
).order(
id_number: :asc
)
end
# rubocop:enable Style/ConditionalAssignment

Expand Down
4 changes: 4 additions & 0 deletions app/lib/google_sheet_api/write_to_tallied_sheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def filtered_direct_messaages
.valid_term_votes
.to_gensosenkyo_main
.order(messaged_at: :asc)
.order(id_number: :asc)
end

def character_names_for_dropdown(tweet_or_dm)
Expand All @@ -90,6 +91,7 @@ def in_public_timeline_tweets
.contains_hashtag('幻水総選挙2021')
.not_by_gensosenkyo_main
.order(tweeted_at: :asc)
.order(id_number: :asc)
end

def odai_shosetsu_tweets
Expand All @@ -99,6 +101,7 @@ def odai_shosetsu_tweets
.contains_hashtag('幻水総選挙お題小説')
.where(tweeted_at: ..Time.zone.parse('2021-06-07 02:20:00'))
.order(tweeted_at: :asc)
.order(id_number: :asc)
end

def oshi_serifu_tweets
Expand All @@ -108,6 +111,7 @@ def oshi_serifu_tweets
.contains_hashtag('幻水総選挙推し台詞')
.where(tweeted_at: ..Time.zone.parse('2021-06-10 23:59:59'))
.order(tweeted_at: :asc)
.order(id_number: :asc)
end

# rubocop:disable Style/RedundantInterpolation
Expand Down
1 change: 1 addition & 0 deletions app/lib/twitter_rest_api/check_public_tweets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def set_not_public_tweet_id_numbers_and_public_tweet_id_numbers
not_public_tweet_id_numbers = []

# データベースに保存してある id_number のツイートを一挙取得して、戻り値に存在するかどうかで public かそうでないかを判断する
# TODO: 並び順の一意性の確保のため、order(id_number: :asc)
Tweet.order(tweeted_at: :asc).pluck(:id_number).each_slice(100) do |sliced_all_id_numbers|
sliced_id_numbers_tweets_id_numbers = @client.statuses(sliced_all_id_numbers).map(&:id)
not_public_tweet_id_numbers_in_this_sliced_id_numbers = sliced_all_id_numbers - sliced_id_numbers_tweets_id_numbers
Expand Down
1 change: 1 addition & 0 deletions app/lib/twitter_rest_api/update_user_records.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def set_not_public_user_objects_and_public_user_objects
not_public_user_objects = []
public_user_objects = []

# TODO: 並び順の一意性の確保のため、order(id_number: :asc)
User.order(created_at: :asc).pluck(:id_number).each_slice(100) do |sliced_all_id_numbers|
sliced_id_numbers_users = @client.users(sliced_all_id_numbers)

Expand Down
1 change: 1 addition & 0 deletions app/models/tweet_from_tweet_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class TweetFromTweetStorage < ApplicationRecord
scope :order_by_id_number_asc, -> { order(id_number: :asc) }

# TODO: Refactoring
# TODO: 並び順の一意性の確保のため、order(id_number: :asc)
# Pick up the latest id_number record
scope :remove_duplicated, lambda {
tweet_id_numbers = pluck(:id_number)
Expand Down

0 comments on commit 6a03db5

Please sign in to comment.