mirror of
https://github.com/sstent/alex_app1.git
synced 2026-01-25 08:34:55 +00:00
just json templates
This commit is contained in:
31
activityjson.example.java
Normal file
31
activityjson.example.java
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"_id":"50ece30020d7bda81a6f21ee",
|
||||||
|
"User_ID":"",
|
||||||
|
"Date":"01/08/2013",
|
||||||
|
"Time":"13:08",
|
||||||
|
"PrivacySetting":"",
|
||||||
|
"Notes":"",
|
||||||
|
"Template_ID":"",
|
||||||
|
"Circuits":[
|
||||||
|
"element number",
|
||||||
|
"element2"
|
||||||
|
],
|
||||||
|
|
||||||
|
"Element":[
|
||||||
|
{
|
||||||
|
"Exercise_ID":"50ee159820d7bda81a6f21f1",
|
||||||
|
---
|
||||||
|
Records for data elements defined in exercise record
|
||||||
|
go here -- eg sets,reps,time
|
||||||
|
---
|
||||||
|
"muscledataarraycalculated":["{}"],
|
||||||
|
"Splits":[
|
||||||
|
{
|
||||||
|
"reps":"1",
|
||||||
|
"weight":"23",
|
||||||
|
"dropset":"y",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
27
app.js
27
app.js
@@ -104,33 +104,44 @@ io.sockets.on('connection', function(socket) {
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
socket.on('getactivites', function(data) {
|
socket.on('getactivites', function(data) {
|
||||||
console.log('getactivities');
|
console.log('getactivities');
|
||||||
|
combinedarray = [0,0,0,0,0,4];
|
||||||
testcollection.find().toArray(function(err, result) {
|
testcollection.find().toArray(function(err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
async.forEachSeries(result,
|
async.forEachSeries(result,
|
||||||
function(item,callback2) {
|
function(item,callback2) {
|
||||||
async.forEachSeries(item.Activities.Activity.Lap,
|
item.Activities.Activity.combinedarray = [0, 0, 0, 0, 0, 0];
|
||||||
|
console.log ('index= ' + result.indexOf(item) );
|
||||||
|
async.forEachSeries(item.Activities.Activity.Lap,
|
||||||
function(itemx,callback3){
|
function(itemx,callback3){
|
||||||
exercisecollection.findById(itemx.selection, function(err, exresult) {
|
exercisecollection.findById(itemx.selection, function(err, exresult) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
muscledataarray = exresult.exercise.muscledata.split(',');
|
||||||
|
console.log('muscledata index' + i + '= ' + JSON.stringify(muscledataarray));
|
||||||
|
for(var i = 0; i < 6; i++) {
|
||||||
|
console.log('muscledata index' + i + '= ' + muscledataarray[i]);
|
||||||
|
item.Activities.Activity.combinedarray[i] = parseInt(muscledataarray[i], 10) + item.Activities.Activity.combinedarray[i];
|
||||||
|
console.log('combinedarray= ' + JSON.stringify(item.Activities.Activity.combinedarray));
|
||||||
|
}
|
||||||
itemx.exercisename = exresult.exercise.name;
|
itemx.exercisename = exresult.exercise.name;
|
||||||
itemx.exercisemuscledata = exresult.exercise.muscledata;
|
itemx.exercisemuscledata = exresult.exercise.muscledata;
|
||||||
itemx.exercisetype = exresult.exercise.type;
|
itemx.exercisetype = exresult.exercise.type;
|
||||||
callback3();
|
callback3();
|
||||||
});
|
});
|
||||||
}, function(err){
|
}, function(err){
|
||||||
|
|
||||||
callback2();
|
callback2();
|
||||||
});
|
});
|
||||||
}, function(err){
|
}, function(err){
|
||||||
/////////THIS is psuedo code for adding the activity arrays
|
/////////THIS is psuedo code for adding the activity arrays
|
||||||
//combinedarray = [0,0,0,0,0,0]
|
//combinedarray = [0,0,0,0,0,0]
|
||||||
// for j in result
|
// for j in result
|
||||||
// do
|
// do
|
||||||
//for i in (1..6)
|
//for i in (1..6)
|
||||||
// do
|
// do
|
||||||
// combinedarray[i] = result[j].exercisemuscledata[i] + combinedarray[i]
|
// combinedarray[i] = result[j].exercisemuscledata[i] + combinedarray[i]
|
||||||
//
|
//
|
||||||
// result.combinedarray = combinedarray
|
// result.combinedarray = combinedarray
|
||||||
socket.emit('populateactivities', result);
|
socket.emit('populateactivities', result);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -139,7 +150,7 @@ io.sockets.on('connection', function(socket) {
|
|||||||
testcollection.findById(id, function(err, result) {
|
testcollection.findById(id, function(err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|
||||||
async.forEachSeries(result.Activities.Activity.Lap,
|
async.forEachSeries(result.Activities.Activity.Lap,
|
||||||
function(itemx,callback3){
|
function(itemx,callback3){
|
||||||
exercisecollection.findById(itemx.selection, function(err, exresult) {
|
exercisecollection.findById(itemx.selection, function(err, exresult) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|||||||
11
exercisejson.example.java
Normal file
11
exercisejson.example.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[{
|
||||||
|
"_id":"50ece28320d7bda81a6f21eb",
|
||||||
|
"Exercise":{
|
||||||
|
"Keywords":["keyword1","keyword2"]
|
||||||
|
"Alternatives":["_Excercise_ID":"234324","_Excercise_ID":"234324"]
|
||||||
|
"Description":"Rough Description of Exercise",
|
||||||
|
"Name":"Bench",
|
||||||
|
"Type":"Exercise",
|
||||||
|
"MuscleData":"2,3,4,5,6"}
|
||||||
|
}
|
||||||
|
]
|
||||||
11
exercisejson.example.json
Normal file
11
exercisejson.example.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"_id":"50ece28320d7bda81a6f21eb",
|
||||||
|
"Exercise":{
|
||||||
|
"Name":"Bench",
|
||||||
|
"Type":"Weights",
|
||||||
|
"Description":"Rough Description of Exercise",
|
||||||
|
"Difficulty":"1",
|
||||||
|
"Keywords":["keyword1","keyword2"],
|
||||||
|
"Alternatives":[{"_Exercise_ID":"234324"},{"_Exercise_ID":"234324"}],
|
||||||
|
"MuscleData":"2,3,4,5,6"}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user