Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chensivan committed Dec 9, 2015
1 parent 0011e89 commit 11ee439
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions lib/voice-assist.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,22 @@ socket.on('addNotification', function(data) {
console.log(data);
//read file and see if the q-id is here

var questionID;
var uid = data.id;
var message;
console.log(" fewafew");
var obj = new Object();
fs.stat(file, function(err, stat){
if (err == null){
obj = JSON.parse(fs.readFileSync(file, 'utf8'));
console.log(obj);
if(!obj.hasOwnProperty(uid)){
obj[uid] = {
response: [data.msg]
};
}else{
obj[uid].response.push(data.msg);

debugger;
if(obj.hasOwnProperty(uid)){
console.log();
obj[uid].response.push(data.msg);
atom.notifications.addSuccess("You received one response for this question:\n "+data.id
+"\n the response is: "+data.msg);
}

console.log(" hi fewafew");
jsonfile.writeFile(file, obj, function (err) {
console.error(err)
})
atom.notifications.addSuccess("You received one response for this question:\n "+data.id
+"\n the response is: "+data.msg);

}
});

Expand Down

0 comments on commit 11ee439

Please sign in to comment.