Skip to content

Commit

Permalink
fix morning emails
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardosasso committed May 24, 2023
1 parent 4b3be8e commit a96e9b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
16 changes: 7 additions & 9 deletions editions/morning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def subject
end

def preheader
field = %i[symbol name].sample
# field = %i[symbol name].sample

stocks = Services::Trending.new.stocks.sample(2).map(&field).join(' and ')
stocks = Services::Trending.new.stocks.sample(2).join(' and ')

this_morning = ['this morning', 'this ' + day_of_the_week.to_s, 'today'].sample

Expand Down Expand Up @@ -54,17 +54,16 @@ def monday_elements
index_summary,
Templates::Element.spacer('20px'),
Templates::Element.divider,
trending(5)
bitcoin_performance
]
end

def tuesday_elements
[
index_performance,
gold_performance,
Templates::Element.spacer('20px'),
Templates::Element.divider,
trending(3)
sector_summary
]
end

Expand All @@ -74,23 +73,22 @@ def wednesday_elements
treasury_performance,
Templates::Element.spacer('20px'),
Templates::Element.divider,
trending(3)
sector_summary
]
end

def thursday_elements
[
index_performance,
russell2000_performance,
Templates::Element.spacer('20px'),
Templates::Element.divider,
trending(3)
sector_summary
]
end

def friday_elements
[
trending(5),
index_performance,
Templates::Element.divider,
crypto
]
Expand Down
2 changes: 2 additions & 0 deletions services/ticker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def stats
end

def name
p details
@name ||= ALIAS[@key] || details.dig('displayName') || details.dig('shortName')
end

Expand Down Expand Up @@ -197,6 +198,7 @@ def details
Config::DETAILS_API + @symbol,
false
)
p result

JSON.parse(result)
.dig('quoteResponse', 'result')
Expand Down
3 changes: 2 additions & 1 deletion services/trending.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def stocks(limit = LIMIT)
trending = request.dig(*key).first.dig('quotes')

trending.take(limit).map do |s|
Ticker.new(s['symbol'])
# Ticker.new(s['symbol'])
s['symbol']
end
end

Expand Down

0 comments on commit a96e9b6

Please sign in to comment.