MCPcopy Index your code
hub / github.com/OneBitCodeBlog/onebitlife / removeCheck

Function removeCheck

src/Services/CheckService.js:37–124  ·  view source on GitHub ↗
(mindHabit, moneyHabit, bodyHabit, funHabit)

Source from the content-addressed store, hash-verified

35};
36
37const removeCheck = (mindHabit, moneyHabit, bodyHabit, funHabit) => {
38 const date = new Date();
39
40 const mindLastCheck =
41 date.getDate() - (new Date(mindHabit?.lastCheck).getDate() + 1);
42
43 if (mindHabit?.habitFrequency === "Diário" && mindLastCheck > 0) {
44 removeCheckHabit({
45 habitIsChecked: 0,
46 habitArea: mindHabit?.habitArea,
47 });
48 }
49 if (mindHabit?.habitFrequency === "Semanal" && mindLastCheck > 7) {
50 removeCheckHabit({
51 habitIsChecked: 0,
52 habitArea: mindHabit?.habitArea,
53 });
54 }
55 if (mindHabit?.habitFrequency === "Mensal" && mindLastCheck > 30) {
56 removeCheckHabit({
57 habitIsChecked: 0,
58 habitArea: mindHabit?.habitArea,
59 });
60 }
61
62 const moneyLastCheck =
63 date.getDate() - (new Date(moneyHabit?.lastCheck).getDate() + 1);
64
65 if (moneyHabit?.habitFrequency === "Diário" && moneyLastCheck > 0) {
66 removeCheckHabit({
67 habitIsChecked: 0,
68 habitArea: moneyHabit?.habitArea,
69 });
70 }
71 if (moneyHabit?.habitFrequency === "Semanal" && moneyLastCheck > 7) {
72 removeCheckHabit({
73 habitIsChecked: 0,
74 habitArea: moneyHabit?.habitArea,
75 });
76 }
77 if (moneyHabit?.habitFrequency === "Mensal" && moneyLastCheck > 30) {
78 removeCheckHabit({
79 habitIsChecked: 0,
80 habitArea: moneyHabit?.habitArea,
81 });
82 }
83 const BodyLastCheck =
84 date.getDate() - (new Date(bodyHabit?.lastCheck).getDate() + 1);
85
86 if (bodyHabit?.habitFrequency === "Diário" && BodyLastCheck > 0) {
87 removeCheckHabit({
88 habitIsChecked: 0,
89 habitArea: bodyHabit?.habitArea,
90 });
91 }
92 if (bodyHabit?.habitFrequency === "Semanal" && BodyLastCheck > 7) {
93 removeCheckHabit({
94 habitIsChecked: 0,

Callers

nothing calls this directly

Calls 1

removeCheckHabitFunction · 0.85

Tested by

no test coverage detected