How to get the sum value from controller?

hi, am using below code in a factory to do some SQLite sum

the code

 myDataFactory.OrderedDishesCount = function () {
            $ionicPlatform.ready(function () {
                console.log("factory ok");
                var query = "SELECT SUM(qty) as ordercount FROM dishesmenu";
                console.log("query ok");
                $cordovaSQLite.execute(db, query).then(function (result) {
                    return result.rows.item(0).ordercount;

but its seem there is something wrong, how to pass the value ? the return statement seem do nothing here