cityssm/lottery-licence-manager

View on GitHub
helpers/licencesDB/getMaxLicenceTicketTypeIndex.js

Summary

Maintainability
A
1 hr
Test Coverage
F
18%
export const getMaxLicenceTicketTypeIndexWithDB = (database, licenceID) => {
    const result = database.prepare("select ticketTypeIndex" +
        " from LotteryLicenceTicketTypes" +
        " where licenceID = ?" +
        " order by ticketTypeIndex desc" +
        " limit 1")
        .get(licenceID);
    return (result
        ? result.ticketTypeIndex
        : -1);
};