diff --git a/src/index.js b/src/index.js index 3d0c3a7..6232174 100644 --- a/src/index.js +++ b/src/index.js @@ -95,11 +95,12 @@ app.get('/callback', function(req, res) { console.log("Scanned size: " + fetch_static_image_size); if(fetch_static_image_size != curr_static_image_size) { - if(post_lap == 0 || post_lap == 12) { // 12 * 5 = 60 - console.log("File size change detected!"); - await Fetch.save_image(static_image_url, static_radar_path); - await Fetch.save_image(animated_image_url, animated_radar_path); + console.log("File size change detected!"); + await Fetch.save_image(static_image_url, static_radar_path); + await Fetch.save_image(animated_image_url, animated_radar_path); + + if(post_lap == 0 || post_lap == 12) { // 12 * 5 = 60 // Fetch static image let static_radar_image_name = `${raw_date.toISOString()}.jpg`; const upload_static_radar = await Post.create_image(host, access_token, static_radar_image_name, static_radar_path); @@ -120,16 +121,16 @@ app.get('/callback', function(req, res) { if(post_note.createdNote) { console.log("Note created!"); - post_lap++; if(post_lap == 12) { post_lap = 0; } - } else { console.log("Note was not created"); } - } + } + + post_lap++; } else { console.log("No change in data, go on."); }