File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 110.01: New app!
2+ 0.02: Handle duplicate menu entries in the app
Original file line number Diff line number Diff line change @@ -35,7 +35,13 @@ function showTallies(tallies) {
3535 menu [ s ] = function ( ) { } ;
3636 day = td ;
3737 }
38- menu [ "" . concat ( tfmt ( tally ) , ": " ) . concat ( tally . name ) ] = function ( ) { return editTally ( tallies , i ) ; } ;
38+ var title = "" . concat ( tfmt ( tally ) , ": " ) . concat ( tally . name ) ;
39+ var n = 2 ;
40+ while ( title in menu ) {
41+ title = "" . concat ( tfmt ( tally ) , " (" ) . concat ( n , "): " ) . concat ( tally . name ) ;
42+ n ++ ;
43+ }
44+ menu [ title ] = function ( ) { return editTally ( tallies , i ) ; } ;
3945 } ) ;
4046 E . showMenu ( menu ) ;
4147}
Original file line number Diff line number Diff line change @@ -45,7 +45,13 @@ function showTallies(tallies: Tally[]) {
4545 day = td ;
4646 }
4747
48- menu [ `${ tfmt ( tally ) } : ${ tally . name } ` ] = ( ) => editTally ( tallies , i ) ;
48+ let title = `${ tfmt ( tally ) } : ${ tally . name } ` ;
49+ let n = 2 ;
50+ while ( title in menu ) {
51+ title = `${ tfmt ( tally ) } (${ n } ): ${ tally . name } `
52+ n ++ ;
53+ }
54+ menu [ title ] = ( ) => editTally ( tallies , i ) ;
4955 } ) ;
5056
5157 E . showMenu ( menu ) ;
Original file line number Diff line number Diff line change 22 "id" : " tally" ,
33 "name" : " Tally Keeper" ,
44 "shortName" : " Tally" ,
5- "version" : " 0.01 " ,
5+ "version" : " 0.02 " ,
66 "author" : " bobrippling" ,
77 "description" : " Add to a tally from clock info" ,
88 "icon" : " app.png" ,
You can’t perform that action at this time.
0 commit comments