Exemple #1
0
            // add steps to streak total
            $total = $total + $steps;
            $count++;
            if ($count == 8) {
                $count = 1;
                pointConversion($conn, $total, $userid);
                $total = 0;
            }
        } else {
            $count = 1;
            $total = 0;
        }
    } else {
        // store streak counter and total and update start date
        setCount($conn, $userid, $count);
        setTotal($conn, $userid, $total);
        setStartDate($date, $conn, $userid);
        break;
    }
    $tmp = strtotime("+1 day", $datets);
    $date = date("Y-m-d", $tmp);
}
function pointConversion($conn, $total, $id)
{
    $before = getPoints($conn, $id);
    $points = 0;
    if ($total >= 49000 && $total <= 69999) {
        $points = 10;
    } else {
        if ($total >= 70000 && $total <= 90999) {
            $points = 15;
        break;
    case 7:
        //add sale to db
        addSale();
        break;
    case 8:
        //all transaction to db
        addTransaction();
        break;
    case 9:
        //get all purchases with a given transaction id
        displaySale();
        break;
    case 10:
        //set the total value of a transaction
        setTotal();
        break;
    case 11:
        //display all transactions
        allTransaction();
        break;
    case 12:
        deleteSale();
        break;
    case 13:
        editSale();
        break;
    default:
        echo '{"result":0,"message":"unknown command"}';
        break;
}