Skip to content

Commit

Permalink
Corretto nome tabella
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioTurco committed Sep 2, 2020
1 parent 9253cdd commit 1e48118
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var lastSelectedRow = null;
deleteRowBtn.onclick = () =>{
deselectEffect(lastSelectedRow);
var date = lastSelectedRow.getElementsByTagName('td')[0].textContent;
db.deleteRow('pesoTest', {'data': date}, (succ, msg) => {
db.deleteRow('peso', {'data': date}, (succ, msg) => {
console.log(msg);
});
location.reload();
Expand All @@ -37,14 +37,14 @@ function deselectEffect(row){
}

function getAllRows(callback){
db.getAll('pesoTest',(succ, data) => {
db.getAll('peso',(succ, data) => {
if(succ)
callback(data);
})
}

function fillTable(){
if( !(db.valid('pesoTest')) )
if( !(db.valid('peso')) )
return;
getAllRows(function(data){
revereSortDataByDate(data);
Expand Down
6 changes: 3 additions & 3 deletions src/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ editRowBtn.onclick = () =>{
"peso" : newPeso,
"kcal" : newKcal
};
db.updateRow('pesoTest', where, set, (succ, msg) => {
db.updateRow('peso', where, set, (succ, msg) => {
// succ - boolean, tells if the call is successful
console.log("Success: " + succ);
console.log("Message: " + msg);
Expand All @@ -89,13 +89,13 @@ function deselectEffect(row){

}
function getAllRows(callback){
db.getAll('pesoTest',(succ, data) => {
db.getAll('peso',(succ, data) => {
if(succ)
callback(data);
})
}
function fillTable(){
if( !(db.valid('pesoTest')) )
if( !(db.valid('peso')) )
return;
getAllRows(function(data){
let index = 1;
Expand Down
10 changes: 5 additions & 5 deletions src/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ const editTab = document.getElementById('editTab');
const deleteTab = document.getElementById('deleteTab');

function createPesoDatabase(){
db.createTable('pesoTest', (succ, msg) => {
db.createTable('peso', (succ, msg) => {
// succ - boolean, tells if the call is successful
console.log("Success: " + succ);
console.log("Message: " + msg);
})
}

function isDuplicate(day, callback){
db.search('pesoTest', 'data', day, (succ, data) => {
db.search('peso', 'data', day, (succ, data) => {
if(data.length>0)
callback(true);
else
Expand All @@ -30,7 +30,7 @@ function isDuplicate(day, callback){

function insertPesoAndKcal(record){
try{
if( db.valid('pesoTest') ){
if( db.valid('peso') ){
console.log(record);
isDuplicate(record.data, function(result){
console.log(result);
Expand All @@ -39,7 +39,7 @@ function insertPesoAndKcal(record){
dataError();
return;
}else{
db.insertTableContent('pesoTest', record, (succ, msg) =>{
db.insertTableContent('peso', record, (succ, msg) =>{
console.log("Insert Success: " + succ);
console.log("Insert Message: " + msg);
});
Expand All @@ -54,7 +54,7 @@ function insertPesoAndKcal(record){
}

function getAllRows(){
db.getAll('pesoTest',(succ, data) => {
db.getAll('peso',(succ, data) => {
console.log(data);
return succ;
})
Expand Down
4 changes: 2 additions & 2 deletions src/visualizeLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function createChart(records){
});
}
function getAllRows(callback){
db.getAll('pesoTest',(succ, data) => {
db.getAll('peso',(succ, data) => {
if(succ)
callback(data);
})
Expand Down Expand Up @@ -165,7 +165,7 @@ function fillStats(data){
kMed.appendChild(document.createTextNode(kcalMedie));
}
async function fillTable(){
if( !(db.valid('pesoTest')) ){
if( !(db.valid('peso')) ){
return;
}
getAllRows(function(data){
Expand Down

0 comments on commit 1e48118

Please sign in to comment.