Skip to content

Commit

Permalink
Merge pull request #234 from tomaszrondio/patch-5
Browse files Browse the repository at this point in the history
SWP-1904 List articles with missing article_statistics correctly
  • Loading branch information
ahilles107 authored Jan 29, 2020
2 parents 8a95e02 + 7ba2221 commit 08fc93f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ exports[`ContentLists/Automatic/ArticleItem renders correctly 1`] = `
<span
class="sd-overflow-ellipsis sd-list-item--element-grow"
>
2 years ago
3 years ago
</span>
<span
class="label"
Expand Down
8 changes: 6 additions & 2 deletions client/services/PublisherHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export function PublisherHelpersFactory() {
let count = 0;

articles.forEach(art => {
count += parseInt(art.article_statistics.page_views_number);
if(art.article_statistics && art.article_statistics.page_views_number) {
count += parseInt(art.article_statistics.page_views_number);
}
});

return count;
Expand All @@ -72,7 +74,9 @@ export function PublisherHelpersFactory() {
let count = 0;

articles.forEach(art => {
count += parseInt(art.comments_count);
if(art.comments_count) {
count += parseInt(art.comments_count);
}
});

return count;
Expand Down

0 comments on commit 08fc93f

Please sign in to comment.