File tree Expand file tree Collapse file tree 3 files changed +171
-21
lines changed
public/assets/defaultData Expand file tree Collapse file tree 3 files changed +171
-21
lines changed Original file line number Diff line number Diff line change 1- import fs from 'fs' ;
2- import path from 'path' ;
3- import { fileURLToPath } from 'url' ;
1+ import fs from 'node: fs' ;
2+ import path from 'node: path' ;
3+ import { fileURLToPath } from 'node: url' ;
44
55const __filename = fileURLToPath ( import . meta. url ) ;
66const __dirname = path . dirname ( __filename ) ;
@@ -32,6 +32,8 @@ const fetchCivilizationsPage = async (offset = 0) => {
3232 params . append ( 'format' , 'json' ) ;
3333 params . append ( 'origin' , '*' ) ;
3434
35+ params . append ( 'where' , 'Civilized IS NOT NULL AND Civilized <> "Uncharted" AND Coordinates IS NOT NULL AND Galaxy IS NOT NULL' ) ;
36+
3537 const url = `${ apiPath } ?${ params . toString ( ) } ` ;
3638 console . log ( `Fetching page with offset: ${ offset } ` ) ;
3739
@@ -67,7 +69,7 @@ const fetchAllCivilizationsAndRegions = async () => {
6769
6870 console . log ( `Total valid items so far: ${ allData . length } ` ) ;
6971
70- if ( pageData . length < 50 ) {
72+ if ( pageData . length < 250 ) {
7173 hasMore = false ;
7274 console . log ( 'Last page reached' ) ;
7375 } else {
Original file line number Diff line number Diff line change @@ -210,6 +210,8 @@ const fetchCivilizationsPage = async (offset = 0) => {
210210 params . append ( 'format' , 'json' ) ;
211211 params . append ( 'origin' , '*' ) ;
212212
213+ params . append ( 'where' , 'Civilized IS NOT NULL AND Civilized <> "Uncharted" AND Coordinates IS NOT NULL AND Galaxy IS NOT NULL' ) ;
214+
213215 const url = `${ apiPath } ?${ params . toString ( ) } ` ;
214216 console . log ( url )
215217 console . log ( `Fetching page with offset: ${ offset } ` ) ;
@@ -237,7 +239,7 @@ const fetchAllCivilizationsAndRegions = async () => {
237239 let hasMore = true ;
238240 let requestCount = 0 ;
239241 const maxRequestsPerSession = Infinity ;
240- const minValidDataThreshold = 50 ;
242+ const minValidDataThreshold = 250 ;
241243 const startTime = Date . now ( ) ;
242244 console . log ( `Starting from cached offset: ${ offset } ` ) ;
243245
@@ -270,7 +272,7 @@ const fetchAllCivilizationsAndRegions = async () => {
270272 setCachedData ( 'nms_partial_civilizations_cache' , partialCacheData ) ;
271273
272274 console . log ( `Total valid items so far: ${ allData . length } ` ) ;
273- if ( pageData . length < 50 ) {
275+ if ( pageData . length < minValidDataThreshold ) {
274276 hasMore = false ;
275277 console . log ( 'Last page reached (less than 50 raw items)' ) ;
276278 } else {
You can’t perform that action at this time.
0 commit comments