From: Taufiq Pohan <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Taufiq Pohan <[email protected]>,
Aldy Prastyo <[email protected]>,
VNLX Kernel Department <[email protected]>,
GNU/Weeb Mailing List <[email protected]>
Subject: [PATCH v1] index: Fix wrong last id at initialization
Date: Sun, 27 Nov 2022 03:21:07 +0700 [thread overview]
Message-ID: <TY0PR06MB5427B43474274D4193C592DBE2119@TY0PR06MB5427.apcprd06.prod.outlook.com> (raw)
In main function, the return from get_last_id is added by 1.
Therefore if we dont have vn-stats.json, the id will start from 2 because
get_last_id will return 1.
Signed-off-by: Taufiq Pohan <[email protected]>
---
index.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.js b/index.js
index 513ffad..0d935dc 100644
--- a/index.js
+++ b/index.js
@@ -71,12 +71,12 @@ function save_last_id(id)
function get_last_id()
{
if (!fs.existsSync('./vn-stats.json'))
- return 1;
+ return 0;
const jsonVal = fs.readFileSync('./vn-stats.json');
let ret = JSON.parse(jsonVal);
if (!("last_vn_id" in ret) || isNaN(ret.last_vn_id))
- return 1;
+ return 0;
return ret.last_vn_id
}
base-commit: 6f43eec419f11a4850c36ec8a046a0425e38b1a2
--
Taufiq Pohan
reply other threads:[~2022-11-26 20:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=TY0PR06MB5427B43474274D4193C592DBE2119@TY0PR06MB5427.apcprd06.prod.outlook.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox