Skip to content

Commit

Permalink
Added to firebase
Browse files Browse the repository at this point in the history
  • Loading branch information
cadebrown committed Sep 17, 2016
1 parent abf6050 commit e434070
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 6 additions & 8 deletions PGS.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ function doWorkload(workload, offline, oncomplete, progFunc) {
}
if (!offline) {
if (jsons.length > 0) {
console.log("Putting in firebase");
putFunctionInFirebase(jsons);
}
}
Expand Down Expand Up @@ -242,11 +243,11 @@ function jsonFunc(func) {
return jsonFunc;
}

function getWorkloadKey(work) {
function getFuncKey(func) {
var nm = "";
for (var k = 0; k < func[i].equation.length; ++k) {
nm += "(" + func[i].equation[k] + ")";
if (k != func[i].equation.length - 1) {
for (var k = 0; k < func.equation.length; ++k) {
nm += "(" + func.equation[k] + ")";
if (k != func.equation.length - 1) {
nm += "-";
}
}
Expand All @@ -257,13 +258,10 @@ function getWorkloadKey(work) {
function putFunctionInFirebase(func) {
var dbr = db.ref("/user_data/" + usr.uid + "/functions/");
var i = 0;
console.log("Putting function online");
console.dir(func);
var refs = {};
for (i = 0; i < func.length; ++i) {
refs[getWorkloadKey(func[i])] = func[i];
dbr.child(getFuncKey(func[i])).set(func[i]);
}
dbr.push(refs);
}

process.on('SIGINT', function() {
Expand Down
2 changes: 2 additions & 0 deletions output/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ PGSO: 40, 40; [41, 1, 1]
PGSO: 40, 40; [41, 1, 1]
PGSO: 40, 40; [41, 1, 1]
PGSO: 40, 40; [41, 1, 1]
PGSO: 40, 40; [41, 1, 1]
PGSO: 40, 40; [41, 1, 1]

0 comments on commit e434070

Please sign in to comment.