diff --git a/lib/user-retention/index.ts b/lib/user-retention/index.ts index 383b155..1061c6e 100644 --- a/lib/user-retention/index.ts +++ b/lib/user-retention/index.ts @@ -56,7 +56,7 @@ const markNewUsers = async () => { } const markActiveUsers = async () => { - // active users from exsited users + // active users from existed users console.time('markActiveUsers1') await sql` INSERT INTO user_retention_history (user_id, state) @@ -126,7 +126,8 @@ const fetchUsersData = async () => { user_retention.created_at as state_updated_at, last_seen FROM user_retention, public.user - WHERE user_retention.user_id = public.user.id;` + WHERE user_retention.user_id = public.user.id + AND public.user.state = 'active';` } //processUserRetention({intervalInDays: 0}).then(()=>{process.exit()}) diff --git a/lib/user-retention/sendmail.ts b/lib/user-retention/sendmail.ts index 6e35ed3..0157d50 100644 --- a/lib/user-retention/sendmail.ts +++ b/lib/user-retention/sendmail.ts @@ -100,7 +100,6 @@ type Article = { id: string title: string displayName: string - mediaHash: string shortHash: string } @@ -141,14 +140,14 @@ export const loadHottestArticles = async ( limit: number, excludedArticleIdsFragment: any ): Promise => sql` - SELECT h.id, avn.title, u.display_name, avn.media_hash, a.short_hash + SELECT h.id, avn.title, u.display_name, a.short_hash FROM article_hottest_materialized h JOIN article a ON h.id = a.id JOIN article_version_newest avn ON h.id = avn.article_id JOIN public.user u ON a.author_id=u.id WHERE a.id NOT IN (SELECT article_id FROM article_read_count WHERE user_id=${userId}) AND a.author_id != ${userId} AND a.id NOT IN ${excludedArticleIdsFragment} - ORDER BY h.score DESC + ORDER BY h.score DESC NULLS LAST LIMIT ${limit}; ` @@ -212,7 +211,6 @@ export const loadNewFeatureArticles = async ( article.id, avn.title, u.display_name, - avn.media_hash, article.short_hash FROM article_tag JOIN article ON article_tag.article_id=article.id @@ -306,7 +304,6 @@ const loadArticles = async ( article.id, avn.title, u.display_name, - avn.media_hash, article.short_hash FROM article INNER JOIN article_version avn diff --git a/matters-server b/matters-server index 1f759b5..e1d3096 160000 --- a/matters-server +++ b/matters-server @@ -1 +1 @@ -Subproject commit 1f759b54501e5decd433bfb4489f0df1df63fa52 +Subproject commit e1d3096585aead1cec4dcaa0edafb6706cdc797e diff --git a/package.json b/package.json index 9f6bed9..4377728 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lambda-handlers-image", - "version": "0.8.13", + "version": "0.8.14", "private": true, "type": "module", "scripts": {