Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save theabhinavdas/ff7bc41d1af26ea4233e9501a813e731 to your computer and use it in GitHub Desktop.
Save theabhinavdas/ff7bc41d1af26ea4233e9501a813e731 to your computer and use it in GitHub Desktop.
DM.fetchEndorsementHistoryOutgoing({
email: req.session.user_email
}, function (e, o1) {
if (e) {
//Log errors if insert into DB fails
console.log(e);
} else {
setValueEndorsee(o1);
}
});
DM.fetchEndorsementHistoryIncoming({
email: req.session.user_email
}, function (e, o2) {
if (e) {
//Log errors if insert into DB fails
console.log(e);
} else {
setValueEndorser(o2);
}
});
function setValueEndorsee(rows) {
endorsee_list_db = rows;
}
function setValueEndorser(rows) {
endorser_list_db = rows;
}
// Initiating call to endorseCandidate() in our smart contract
// Passing the email and skills
// Setting up a gas price and sender address - testrpc account [0]
Endorse.deployed().then(function (contractInstance) {
//Returning details of the candidate in the log
return contractInstance.userDetails.call(req.user.email).then(function (o) {
let skillsArray = o[2];
for (let i = 0; i < skillsArray.length; i++) {
skillsArray[i] = web3.toUtf8(skillsArray[i]);
}
console.log(endorsee_list_db);
res.render('profile', {
title: 'Ranking System',
user: req.user.name,
email: web3.toUtf8(o[0]),
rank: o[1].toString(),
skills: skillsArray,
address: o[3],
endorsee_list: endorsee_list_db
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment