-
Notifications
You must be signed in to change notification settings - Fork 35
updated onboarding project #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
nkosimarz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to get a formatter for your VScode and also get rid of a lot of empty line
app.ts
Outdated
| @@ -0,0 +1,374 @@ | |||
| namespace onboardproject { | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am manage to fix my format and empty line on the code
app.ts
Outdated
| const response = await fetch('http://localhost:2050/recordCount'); | ||
|
|
||
| let promise = new Promise((res, rej) => { | ||
| setTimeout(() => res("Now it's done!"), 50) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this meant to be Load
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, which mean my async function is going to be pause until a Promise is Settled (that is, fulfilled or rejected), and to resume execution of the async function after fulfillment( i was using it ,to test my function inside )
FritzOnFire
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, remove your try-catches. All of them seem to be in functions that are async and return promises so the calling function should be able to catch any errors.
Please put an empty line between your function definitions.
|
Also, why is your previouses an array? I think you should rather just have a number or two. |
pierrehenrinortje
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with Fritz, some extra comments on my end.
| const fromId = ConvertNumber($("#index").val() as string, false); | ||
| const possibleStep = calculateToId(fromId) - fromId; | ||
| if (fromId < 0) { | ||
| alert('only insert Id greater than or equal to 0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a return here so we can remove the next "else" below. This is more readable and reduces excessive indentation in cases where larger nested "if else" statements exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on this line is still relevant.
app.ts
Outdated
| namespace onboardproject { | ||
| module onboardprojects { | ||
|
|
||
| //Load Variable declarations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a space after the //
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment on this line is still relevant.
app.ts
Outdated
| let Load = 50; | ||
| // Previous Variable declarations | ||
| let previous: number[]; | ||
| //Previous Process Variable declarations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a space after the //
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment on this line is still relevant.
| }); | ||
| //Searching function for index | ||
| $("#go-button").click(async () => { | ||
| const recordCount = await getRecordCountCall(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are allowed to skip this step. For this project the record count will not change after the initial call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the formatting looks a lot better. But for me to approve this, I am going to need you to remove all the try-catchs, and you have to stop using an array to store your fromid and toid (it just feels like an anti-pattern).
Oh, and add your dist/app.min.js to your gitignore.
app.ts
Outdated
| // let promise = new Promise((res, rej) => { | ||
| // setTimeout(() => res("Now it's done!"), 50) | ||
| // }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need these comments anymore.
app.ts
Outdated
| // let promise = new Promise((res, rej) => { | ||
| // setTimeout(() => res("Now it's done!"), 50) | ||
| // }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need these comments anymore.
app.ts
Outdated
| // let promise = new Promise((res, rej) => { | ||
| // setTimeout(() => res("Now it's done!"), 50) | ||
| // }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need these comments anymore.
app.ts
Outdated
| // } | ||
| // }; | ||
| // } | ||
| //region Data Loading methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment is still relevant on this line.
app.ts
Outdated
| DisplayContent += '</tr>'; | ||
| $("#wrapper-table-content-body").empty(); | ||
| $("#wrapper-table-content-body").append(DisplayContent); | ||
| throw new Error("Error No data"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this not throw an error every time you call this function?
app.ts
Outdated
| return toID; | ||
| } | ||
|
|
||
| //Onload Function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a space after the //, and an empty line above this line.
app.ts
Outdated
| //Onload Function | ||
| window.onload = async () => { | ||
|
|
||
| //Previous_Page_Resize Function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a space after the //, and an empty line above this line.
app.ts
Outdated
| return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; | ||
| } | ||
|
|
||
| //On Resize_Function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a space after the //, and an empty line above this line.
app.ts
Outdated
| const toId = calculateToId(previous[0] - (nextPageResize(previous) - previous[0])); | ||
| return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should rather store the result of nextPageResize and use that, than calling that function multiple times
| const fromId = ConvertNumber($("#index").val() as string, false); | ||
| const possibleStep = calculateToId(fromId) - fromId; | ||
| if (fromId < 0) { | ||
| alert('only insert Id greater than or equal to 0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on this line is still relevant.
No description provided.