Hello,
This is exactly what I was looking for. Thank you so much.
I'm way over my head with writing code for this and would really appreciate any help. To be honest, as you can probably tell by seeing my coding attempt below, I don't really what I'm doing hehe. I've read several posts in the past couple of hours on this but still don't have a clear direction.
My objective:
1) Upon completion of a task, a user check marks the associated task checkbox
2) This information gets updated to the database in the form of -- "logged in user" has completed tasks 1,2,3,4,5,6,7 ... out of 100
3) This information then gets displayed in the form of a progress bar for the user to see
What I've done so far...
I've created a collection called 'TaskCompletionStatus' and have added the following fields:
Member Email:
Task Status: for taking in the user input from checkbox
Task Number: this is for the progress bar. Each checkbox will have a number associated with it. So if user has completed 15 out of 40 tasks, the progress bar will show this.
For getting the user information and inserting into the database, I have the following code which I know I'm messing up and would appreciate any help with this.
import wixUsers from 'wix-users';
import wixData from 'wix-data';
$w.onReady(function () {
let user = wixUsers.currentUser;
user.getEmail()
.then((email) => {
let userEmail = email;
});
});
export function day01task01_change(event) {
// when user clicks checkbox
let toInsert = {
"memberEmail": "email",
"taskCompletionStatus": "taskstatus",
"taskCompletionNumber": "tasknumber",
};
wixData.insert("TaskCompletionStatus", toInsert)
.then((results) => {
let item = results;
})
.catch((err) => {
let errorMsg = err;
});
}
Right now I can't even get the database to populate, so I haven't even began implementing the other steps for actually displaying updated information to the user.
Appreciate any help.
Thank you.