File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { getDBDir } from "./helpers";
33
44const dbPath = getDBDir ( "sqlite" , "data.sqlite" ) ;
55
6- export const db = connect ( dbPath , {
7- client : "sql.js" ,
8- } ) ;
9- // export const db = connect(dbPath);
6+ // export const db = connect(dbPath, {
7+ // client: "sql.js",
8+ // });
9+ export const db = connect ( dbPath ) ;
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export const getDBDir = (dbname: string, dbfile: string) => {
88 console . log ( "kkk ELECTRON HOME path: " , app . getPath ( "home" ) ) ;
99 console . log ( "kkk ELECTRON userData path: " , app . getPath ( "userData" ) ) ;
1010 const dirPath = path . join ( app . getPath ( "userData" ) , "db" , dbname ) ;
11- if ( ! fs . existsSync ( dirPath ) ) fs . mkdirSync ( dirPath ) ;
11+ if ( ! fs . existsSync ( dirPath ) ) fs . mkdirSync ( dirPath , { recursive : true } ) ;
1212 return path . join ( dirPath , dbfile ) ;
1313} ;
1414
Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ export const addUserstoDB = async (
3737 setProgress : React . Dispatch < React . SetStateAction < number > > ,
3838 saveTimeTaken ?: React . Dispatch < React . SetStateAction < [ number , number ] > >
3939) => {
40- setProgress ( 100 ) ;
41- const progrssVal = 0 ;
40+ setProgress ( 0 ) ;
41+ let progrssVal = 0 ;
4242 const users = await getUserModel ( ) ;
4343 const t0 = performance . now ( ) ;
4444 const timeTaken = [ ] ;
@@ -53,7 +53,11 @@ export const addUserstoDB = async (
5353 // await Promise.all(usersListPromise);
5454 await promiseProgress ( usersListPromise , ( percent ) => {
5555 // set progress only for 1% increase
56- if ( progrssVal + 1 <= percent ) setProgress ( percent ) ;
56+ if ( progrssVal + 1 <= percent ) {
57+ console . log ( "kke progress => " , percent , progrssVal ) ;
58+ progrssVal = Math . ceil ( percent ) ;
59+ setProgress ( percent ) ;
60+ }
5761 } ) ;
5862
5963 const ta1 = performance . now ( ) ;
You can’t perform that action at this time.
0 commit comments