-
Notifications
You must be signed in to change notification settings - Fork 56
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
Fixes #66 added user/progress mock endpoint #117
Fixes #66 added user/progress mock endpoint #117
Conversation
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.
Also, this might've gotten lost in the bottom of the issue description but we also want to call this endpoint from the browser:
Once the main.js loads, add an AJAX call (using fetch, not jQuery) to the above endpoint and set the current question to the returned currentQuestionNumber
public/scripts/main.js
Outdated
function getUserProgress() { | ||
return fetch(document.URL + 'user/progress') | ||
} | ||
|
||
function nextQuestion() { |
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 did auto formatting from this line to the last...Let me know if I need to remove this.
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 actually can you please only include changes relevant to the PR. Unfortunately we didn't get #89 merged prior to OSD which would've helped. Otherwise we'll get a bunch of spurious conflicts later.
If you're using VSCode, they added a really nice feature to only auto-format modified lines which you can enable in settings. Search settings for "Format". That really helps with these messy and non-standardized codebases 😄
If you're using another editor, one technique I've used is to do git add -p
when staging which lets me just choose the hunks I've edited and not the rest of them produced by any auto-formatting. HTH
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.
Your changes look great! I just had a few revision requests when you get a chance. Thanks for working on this.
public/scripts/main.js
Outdated
function getUserProgress() { | ||
return fetch(document.URL + 'user/progress') | ||
} | ||
|
||
function nextQuestion() { |
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 actually can you please only include changes relevant to the PR. Unfortunately we didn't get #89 merged prior to OSD which would've helped. Otherwise we'll get a bunch of spurious conflicts later.
If you're using VSCode, they added a really nice feature to only auto-format modified lines which you can enable in settings. Search settings for "Format". That really helps with these messy and non-standardized codebases 😄
If you're using another editor, one technique I've used is to do git add -p
when staging which lets me just choose the hunks I've edited and not the rest of them produced by any auto-formatting. HTH
public/scripts/main.js
Outdated
if (!response.ok) { | ||
const message = `An error has occured: ${response.status}`; | ||
console.error(message) | ||
return 1 |
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.
Thanks for adding error handling.
However, just by reading, doesn't the returned value have to be { currentQuestionNumber: 1 }
for the next part to work? I haven't tried it so I could be wrong.
public/scripts/main.js
Outdated
$('.container').css('height', $(window).height()); | ||
}); | ||
}); | ||
|
||
function getUserProgress() { | ||
return fetch(document.URL + 'user/progress') |
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.
Can you change this to just a relative url of /user/progress
? We don't really need the other part explicitly.
f00563b
to
2e06d3a
Compare
Hi, I am sorry how this got closed, Just reopen it again if there are any conflicts or needs revision. |
This PR hasn't been merged, so I'll just open a new PR and push only relevant code as discussed here. My apologies for the mess. |
GET request has been added for user/progress. Have created a new directory which we can remove later once the endpoint is ready or this may help while writing the test cases.