add logic for habit done
This commit is contained in:
@@ -16,7 +16,7 @@ const HabitManager = {
|
||||
|
||||
HabitManager.createHabit = function (name, description, targetCount = 1) {
|
||||
const habit = {
|
||||
id: Math.random(),
|
||||
id: Math.floor(Math.random() * 100000, 10000),
|
||||
name: name,
|
||||
description: description,
|
||||
targetCount: targetCount,
|
||||
@@ -31,6 +31,7 @@ HabitManager.createHabit = function (name, description, targetCount = 1) {
|
||||
}
|
||||
|
||||
HabitManager.markHabitDone = function (habitId) {
|
||||
console.log(this.habits);
|
||||
const habit = this.habits.find(h => h.id === habitId);
|
||||
|
||||
if (!habit) {
|
||||
|
||||
Reference in New Issue
Block a user