Skip to content

Talyia Khalid - Selection Project#12

Open
TalyiaKhalid wants to merge 1 commit intoGDSC-IAU:masterfrom
TalyiaKhalid:master
Open

Talyia Khalid - Selection Project#12
TalyiaKhalid wants to merge 1 commit intoGDSC-IAU:masterfrom
TalyiaKhalid:master

Conversation

@TalyiaKhalid
Copy link

No description provided.

Copy link
Contributor

@RyamAlmalki RyamAlmalki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, amazing work Taliya. Very proud of you!

print("\n*********************************************");
}
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a logical issue with the Edit Note feature. First, let's take a look at the problem...

First user creates 2 notes
Screen Shot 1445-07-20 at 12 24 03 PM

The user decides to edit note one; however, after editing the note, they receive an "ID not present" error, even though it is present, and the note was edited.
Screen Shot 1445-07-20 at 12 25 10 PM

Now, where did the issue arise from?
Screen Shot 1445-07-20 at 12 27 08 PM
If you carefully track how it works, you will notice that when the second loop runs, it sends a 'not found' ID because note.id and noteid are no longer equal.

Now, to solve this logical problem, we need to make a small code enhancement. We can use .where instead of a for loop.

Screen Shot 1445-07-20 at 12 41 11 PM

print(
"Note ID: ${note.id}\nNote name: ${note.title}\nNote Description: ${note.description}");
print("\n**********************************************");
} else if (i == notes.length - 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a logical issue with Search Note. It is the same issue as with the Edit Note. Use this as a challenge to try to fix the logical problem. I believe in you.

print("Note Removed Successfully.");
print("\n***************************************");
break;
} else if (i == notes.length - 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't encountered the issue here because you added the break after deleting the note. However, it's better to use where since using this line of code may not be very readable: `else if (i == notes.length - 1) {

Copy link
Contributor

@RyamAlmalki RyamAlmalki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, one thing is missing: 'Allow users to search for notes by title and content.' It shouldn't be by ID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants