From e042fd04969144293fb7147ec9cbb232b53520a4 Mon Sep 17 00:00:00 2001
From: BrittainJackson7 <brittainjackson7@gmail.com>
Date: Fri, 10 Nov 2023 11:36:04 -0700
Subject: [PATCH] Update offset to be scaleable

---
 src/js/FootprintFetcher.js | 62 +++-----------------------------------
 1 file changed, 4 insertions(+), 58 deletions(-)

diff --git a/src/js/FootprintFetcher.js b/src/js/FootprintFetcher.js
index 332d2ad90..045af2d43 100644
--- a/src/js/FootprintFetcher.js
+++ b/src/js/FootprintFetcher.js
@@ -64,65 +64,11 @@ export async function FetchFootprints(collection, page, step){
     // check for pyGeo API
     if (!collection.url.includes('stac')) 
     {
+        collectionUrl = collection.url.split('&limit=')[0];
 
-        // set offset for 5 & 10 steps
-        offsetMulitiplier = (page * 10 - step);
-        pageInfo = "&offset=" + offsetMulitiplier;
-
-        
-        // checks for 5 change in step
-        if (step <= 10)
-        {
-               
-            // splice limit and change to new limit
-            collectionUrl = collection.url.split('&limit=')[0];
-            collection.url = collectionUrl;
-                
-                
-            // update page pageInfo
-            pageInfo = "&offset=" + offsetMulitiplier + "&limit=" + step;
-            
-            
-        }
-        // checks for 50 & 100 step
-        else if (step == 50 || step == 100)
-        {
-
-            // splice limit and change to new limit
-            collectionUrl = collection.url.split('&limit=')[0];
-            collection.url = collectionUrl;
-
-            // check for first page 
-            if (page == 1)
-            {
-                // set multiplier to 0
-                offsetMulitiplier = 0;
-            }
-            // check for second page
-            else if (page == 2)
-            {   
-                // set multiplier to step
-                offsetMulitiplier = step;
-            
-            }
-            else
-            {
-                // check for 50 and set pages according
-                if (step == 50)
-                {
-                    offsetMulitiplier = page * step - 50;
-                }
-                // check for 100 and set pages according
-                else 
-                {
-                    offsetMulitiplier = page * step - 100;
-                }
-            }
-
-            // update page pageInfo
-            pageInfo = "&offset=" + offsetMulitiplier + "&limit=" + step;
-        }
-        
+        offsetMulitiplier = (page - 1) * step;
+
+        collection.url = `${collectionUrl}&offset=${offsetMulitiplier}&limit=${step}`;
     }
     
     // reset offset
-- 
GitLab