@@ -21,10 +21,11 @@ if (jsonData == 'Error') {
2121const fs = require ( 'fs' ) ;
2222const path = require ( 'path' ) ; //base_path = path.resolve();
2323const base_path = __dirname || process . cwd ( ) ;
24- const target_path = path . resolve ( base_path + '\\data\\json\\ ' ) ;
24+ const target_path = path . resolve ( base_path + '\\data\\json' ) ;
2525const target_ext = '.json' ;
2626
2727const local_debug = Boolean ( 0 ) ;
28+ const local_verbose = Boolean ( 1 ) ;
2829
2930
3031function read_files ( target_path ) {
@@ -84,8 +85,10 @@ function get_score(data) {
8485 'relations_count' : { }
8586 } ;
8687 for ( const project_data of Object . values ( data ) ) {
87- if ( ! project_data . meta . added_by ) console . log ( 'No "Added by" field:' , project_data ) ;
88- if ( ! project_data . name ) console . log ( 'No "Added by" field:' , project_data ) ;
88+ //console.log("project_data", project_data);
89+ //if (!project_data.meta) console.log('No "Meta" field:', project_data);
90+ //if (!project_data.meta.added_by) console.log('No "Added by" field:', project_data);
91+ //if (!project_data.name) console.log('No "Added by" field:', project_data);
8992
9093 if ( ! score . adders [ project_data . meta . added_by ] ) score . adders [ project_data . meta . added_by ] = 0 ;
9194 if ( ! score . relations_count [ project_data . name ] ) score . relations_count [ project_data . name ] = 0 ;
@@ -113,10 +116,6 @@ function get_score(data) {
113116 return score ;
114117}
115118
116- function require_project ( project_id ) {
117- return require ( target_path + project_id + target_ext ) || false ;
118- }
119-
120119// http://stackoverflow.com/a/25500462/8175291
121120function dict_sort ( dict , keys_pos_inverted = true ) {
122121 // Create items array
@@ -158,16 +157,16 @@ async function main() {
158157
159158 console . log ( 'base_path:' , base_path ) ;
160159 console . log ( 'target_path:' , target_path ) ;
161- console . log ( 'target_ext:' , target_ext ) ;
160+ // console.log('target_ext:', target_ext);
162161
163162 //const jsonData = require_project('000');
164163 //console.log('jsonData:', jsonData);
165164
166165 const _out = read_files ( target_path ) ;
167- console . log ( 'read_files (1):' , _out ) ;
166+ if ( local_verbose ) console . log ( 'read_files (1):' , _out ) ;
168167
169168 const score = get_score ( _out ) ;
170- console . log ( 'get_score (1):' , score ) ;
169+ if ( local_verbose ) console . log ( 'get_score (1):' , score ) ;
171170
172171
173172 const _out2 = read_files ( target_path + '\\outsourcing\\' ) ;
0 commit comments