I am getting 'console.log(‘Message’) is not a function.
And the simple code below returns {} in stead of the expected values.
Is something up with the site?
async function getNewLeg(){
let flights = await wixData.query( ‘plannedflights’ ).descending( ‘leg’ ).find()
var records = flights.totalCount
console.log( 'Number of flights: ’ + records)
var newleg
if (records === 0 ) {
newleg = 10 ;
}
else {
let onlyitem = flights.items[ 0 ];
console.log( 'Current Record to Update: ’ + JSON.stringify(onlyitem))
var lastleg = onlyitem.leg;
newleg = lastleg + 10 ;
}
console.log = ( 'New Leg: ’ + newleg)
return newleg
}