Fix a couple things and modify dev digest logic (#1954)
This commit is contained in:
parent
70b7414a28
commit
f280d9e266
8 changed files with 29 additions and 15 deletions
|
|
@ -50,7 +50,7 @@ function insertNewArticles(user){
|
|||
if (rand < 0.3) {
|
||||
articlePoints = articlePoints + 1
|
||||
} else if (rand < 0.6) {
|
||||
articlePoints = articlePoints + 2
|
||||
articlePoints = articlePoints + 3
|
||||
}
|
||||
articlePoints = articlePoints - (experienceDifference/2);
|
||||
article['points'] = articlePoints
|
||||
|
|
@ -60,7 +60,7 @@ function insertNewArticles(user){
|
|||
});
|
||||
sortedArticles.forEach(function(article){
|
||||
var parent = insertPlace.parentNode;
|
||||
if ( article.points > 13 && !document.getElementById("article-link-"+article.id) ) {
|
||||
if ( article.points > 12 && !document.getElementById("article-link-"+article.id) ) {
|
||||
insertArticle(article,parent,insertPlace);
|
||||
}
|
||||
});
|
||||
|
|
@ -95,7 +95,7 @@ function insertTopArticles(user){
|
|||
if (rand < 0.3) {
|
||||
articlePoints = articlePoints + 1
|
||||
} else if (rand < 0.6) {
|
||||
articlePoints = articlePoints + 2
|
||||
articlePoints = articlePoints + 3
|
||||
}
|
||||
articlePoints = articlePoints - (experienceDifference/2);
|
||||
article['points'] = articlePoints
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@ class Internal::ArticlesController < Internal::ApplicationController
|
|||
page(params[:page]).
|
||||
limited_columns_internal_select.
|
||||
per(50)
|
||||
when "satellite"
|
||||
@articles = Article.
|
||||
where(last_buffered: nil, published: true).
|
||||
includes(:user).
|
||||
includes(:buffer_updates).
|
||||
order("hotness_score DESC").
|
||||
tagged_with(Tag.bufferized_tags).
|
||||
page(params[:page]).
|
||||
limited_columns_internal_select.
|
||||
per(60)
|
||||
when "boosted-additional-articles"
|
||||
@articles = Article.
|
||||
includes(:user).
|
||||
|
|
|
|||
|
|
@ -25,12 +25,11 @@ class UsersController < ApplicationController
|
|||
if @user.update(permitted_attributes(@user))
|
||||
RssReader.new(request.request_id).delay.fetch_user(@user) if @user.feed_url.present?
|
||||
notice = "Your profile was successfully updated."
|
||||
|
||||
if @user.export_requested?
|
||||
notice = notice + " The export will be emailed to you shortly."
|
||||
Exporter::Service.new(@user).delay.export(send_email: true)
|
||||
end
|
||||
|
||||
cookies.permanent[:user_experience_level] = @user.experience_level.to_s if @user.experience_level.present?
|
||||
follow_hiring_tag(@user)
|
||||
@user.touch(:profile_updated_at)
|
||||
redirect_to "/settings/#{@tab}", notice: notice
|
||||
|
|
|
|||
|
|
@ -29,6 +29,6 @@ class EmailDigest
|
|||
private
|
||||
|
||||
def get_users
|
||||
User.where(email_digest_periodic: true)
|
||||
User.where(email_digest_periodic: true).where.not(email: "")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class EmailLogic
|
|||
where("score > ?", 12).
|
||||
where("experience_level_rating > ? AND experience_level_rating < ?", (@user.experience_level || 5) - 3.6, (@user.experience_level || 5) + 3.6).
|
||||
order("score DESC").
|
||||
limit(6)
|
||||
limit(8)
|
||||
else
|
||||
Article.
|
||||
where("published_at > ?", fresh_date).
|
||||
|
|
@ -46,7 +46,7 @@ class EmailLogic
|
|||
where.not(user_id: @user.id).
|
||||
where("score > ?", 25).
|
||||
order("score DESC").
|
||||
limit(6)
|
||||
limit(8)
|
||||
end
|
||||
if articles.length < 3
|
||||
@ready_to_receive_email = false
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@
|
|||
<a href="/internal/articles?state=not-buffered-0.25" class="btn <%= "btn-success" if params[:state] == "not-buffered-0.25" %>">6hr</a>
|
||||
<a href="/internal/articles?state=not-buffered-1" class="btn <%= "btn-success" if params[:state] == "not-buffered-1" %>">1d</a>
|
||||
<a href="/internal/articles?state=not-buffered-7" class="btn <%= "btn-success" if params[:state] == "not-buffered-7" %>">7d</a>
|
||||
<a href="/internal/articles?state=satellite" class="btn <%= "btn-success" if params[:state] == "satellite" %>">🛰</a>
|
||||
Top:
|
||||
<a href="/internal/articles?state=top-3" class="btn <%= "btn-success" if params[:state] == "top-3" %>">3mo</a>
|
||||
<a href="/internal/articles?state=top-6" class="btn <%= "btn-success" if params[:state] == "top-6" %>">6mo</a>
|
||||
<a href="/internal/articles?state=boosted-additional-articles" class="btn <%= "btn-success" if params[:state] == "boosted-additional-articles" %>">Boosted</a>
|
||||
</h3>
|
||||
<br />
|
||||
|
|
|
|||
|
|
@ -87,10 +87,6 @@
|
|||
border: 12px solid #ff9900;
|
||||
}
|
||||
|
||||
a {
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.highlighted-bg {
|
||||
background: #2effa8 !important;
|
||||
border: 20px solid black;
|
||||
|
|
|
|||
|
|
@ -5,14 +5,23 @@
|
|||
<ul>
|
||||
<% @articles.each do |article| %>
|
||||
<li style="margin:18px auto">
|
||||
<a href="https://dev.to<%= article.path %>" style="font-weight: bold;color:#0045ff;font-size:1.06em;"><%= article.title.strip %></a> <%= truncate(article.description, length: 80) %>
|
||||
<a href="https://dev.to<%= article.path %>" style="font-weight: bold;color:#0045ff;font-size:calc(0.93em + 0.2vw);"><%= article.title.strip %></a> <%= truncate(article.description, length: 120) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<hr />
|
||||
</ul>
|
||||
|
||||
<center style="margin-top:50px;">
|
||||
<em>
|
||||
<% if @user.follows.size == 0 %>
|
||||
<% if @user.experience_level == nil %>
|
||||
<b>
|
||||
You can now add your coding experience level to your account in order to receive more relevant content.
|
||||
</b>
|
||||
<br /><br />
|
||||
Visit <b><a href="https://dev.to/settings/misc" style="text-decoration: none;">your settings</a></b> to enter your experience level on a scale of 1-10.
|
||||
<br /><br />
|
||||
You can change it any time in the future. Happy coding!
|
||||
<% elsif @user.follows.size == 0 %>
|
||||
<b>
|
||||
DEV Digest is a new periodic email featuring the best posts from our community of developers.
|
||||
</b>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue