Skip to content

Commit

Permalink
don't insert into all_article_word_data for articles that already are…
Browse files Browse the repository at this point in the history
… in the data #29
  • Loading branch information
nramos0 committed Sep 13, 2021
1 parent 8c0b371 commit 111489d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions backend/src/db/user/all_article_word_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ pub async fn insert_articles(
let article_id = article_words.id;
let unique_words = &article_words.unique_words;

// don't add article if it already exists in the data
if all_article_word_data_lang
.get("article_word_counts")
.unwrap()
.as_object()
.unwrap()
.get(
&article_id.to_string(),
).is_some() {
return;
};

let mut new_count = 0i64;
let mut learning_count = 0i64;
let mut known_count = 0i64;
Expand Down

0 comments on commit 111489d

Please sign in to comment.