File tree 3 files changed +12
-8
lines changed
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";
3
3
4
4
const dbPath = getDBDir ( "sqlite" , "data.sqlite" ) ;
5
5
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) => {
8
8
console . log ( "kkk ELECTRON HOME path: " , app . getPath ( "home" ) ) ;
9
9
console . log ( "kkk ELECTRON userData path: " , app . getPath ( "userData" ) ) ;
10
10
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 } ) ;
12
12
return path . join ( dirPath , dbfile ) ;
13
13
} ;
14
14
Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ export const addUserstoDB = async (
37
37
setProgress : React . Dispatch < React . SetStateAction < number > > ,
38
38
saveTimeTaken ?: React . Dispatch < React . SetStateAction < [ number , number ] > >
39
39
) => {
40
- setProgress ( 100 ) ;
41
- const progrssVal = 0 ;
40
+ setProgress ( 0 ) ;
41
+ let progrssVal = 0 ;
42
42
const users = await getUserModel ( ) ;
43
43
const t0 = performance . now ( ) ;
44
44
const timeTaken = [ ] ;
@@ -53,7 +53,11 @@ export const addUserstoDB = async (
53
53
// await Promise.all(usersListPromise);
54
54
await promiseProgress ( usersListPromise , ( percent ) => {
55
55
// 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
+ }
57
61
} ) ;
58
62
59
63
const ta1 = performance . now ( ) ;
You can’t perform that action at this time.
0 commit comments