Fix mistake that prevented last_updated from being set
This commit is contained in:
parent
a9ae7f938c
commit
ed9eba7137
|
@ -174,10 +174,11 @@ export function syncWords(remoteWords, deletedWords) {
|
|||
}
|
||||
|
||||
remoteWords.forEach(remoteWord => {
|
||||
let localWord = words.find(word => word.wordId === remoteWord.wordId);
|
||||
const localWordIndex = words.findIndex(word => word.wordId === remoteWord.wordId);
|
||||
const localWord = words[localWordIndex];
|
||||
if (localWord) {
|
||||
if (localWord.lastUpdated < remoteWord.lastUpdated) {
|
||||
localWord = remoteWord;
|
||||
words[localWordIndex] = remoteWord;
|
||||
} else if (localWord.lastUpdated > remoteWord.lastUpdated) {
|
||||
// Add more-recently-updated words to upload
|
||||
localWordsToUpload.push(localWord);
|
||||
|
|
|
@ -258,7 +258,7 @@ WHERE dictionary=$dictionary";
|
|||
$word_ids = array();
|
||||
$most_recent_word_update = 0;
|
||||
foreach($words as $word) {
|
||||
$last_updated = isset($word['lastUpdated']) ? $word['createdOn'] : $word['lastUpdated'];
|
||||
$last_updated = isset($word['lastUpdated']) ? $word['lastUpdated'] : $word['createdOn'];
|
||||
if ($most_recent_word_update < $last_updated) {
|
||||
$most_recent_word_update = $last_updated;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue