MCPcopy Create free account
hub / github.com/OneBitCodeBlog/onebitlife / checkHabit

Function checkHabit

src/Services/CheckService.js:5–19  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

3import HabitsService from "./HabitsService";
4
5const checkHabit = (obj) => {
6 return new Promise((resolve, reject) => {
7 db.transaction((tx) => {
8 tx.executeSql(
9 "UPDATE habits SET lastCheck=?, habitIsChecked=?, habitChecks=? WHERE habitArea=?;",
10 [obj.lastCheck, obj.habitIsChecked, obj.habitChecks, obj.habitArea],
11 (_, { rowsAffected }) => {
12 if (rowsAffected > 0) resolve(rowsAffected);
13 else reject("Error updating obj");
14 },
15 (_, error) => reject(error)
16 );
17 });
18 });
19};
20
21const removeCheckHabit = (obj) => {
22 return new Promise((resolve, reject) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected