Fix patch not present in database
All checks were successful
pipeline / build-and-push-images (push) Successful in 56s
All checks were successful
pipeline / build-and-push-images (push) Successful in 56s
This commit is contained in:
@@ -41,9 +41,13 @@ async function compareLatestSavedPatch(client: MongoClient, newPatch : string, n
|
||||
const patches = database.collection("patches")
|
||||
const latestPatch = await patches.find().limit(1).sort({date:-1}).next()
|
||||
|
||||
if(latestPatch == null) {
|
||||
console.log("No previous patch recorded in database.")
|
||||
} else {
|
||||
console.log("Latest patch in database is: " + latestPatch.patch)
|
||||
}
|
||||
|
||||
if(latestPatch.patch != newPatch) {
|
||||
if(latestPatch == null || latestPatch.patch != newPatch) {
|
||||
await patches.insertOne({patch:newPatch, date:newDate})
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user