Skip to content
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

Add endpoints to API #83

Merged
merged 24 commits into from
Oct 6, 2019
Merged

Add endpoints to API #83

merged 24 commits into from
Oct 6, 2019

Conversation

courtneycb
Copy link
Contributor

@courtneycb courtneycb commented Sep 26, 2019

Adds the following API endpoints:

Endpoint for: Study class
URL: codewof.co.nz/api-studies
Accessible to: Admins
Data: Shows all studies with the following data for each: study ID, title, user types and researchers.

Endpoint for: StudyGroup class
URL: Not accessible through the browsable API. Used as a helper class.
Accessible to: Admins
Data: Shows all studies with the following data for each: study group ID, title and questions.

Endpoint for: User class
URL: codewof.co.nz/api-users
Accessible to: Admins
Data: Shows all users with the following data for each: user ID, email, first name, last name and user type.

Endpoint for: Profile class
URL: Not accessible through the browsable API. Used as a helper class.
Accessible to: Admins
Data: Shows all profiles with the following data for each: user ID and email.

Endpoint for: Attempt class
URL: codewof.co.nz/api-attempts
Accessible to: Admins
Data: Shows all attempts with the following data for each: attempt ID, datetime, question ID, user code for the attempt, if the tests passed or not and the profile of the user that submitted the attempt; this contains the ID of the user and email of the user.

The following URL takes a long time to load because of the data we are fetching. We aren't worried about this at the moment.
Endpoint for: Study class (except only shows one particular study)
URL: codewof.co.nz/api-study/?study_id=<study_id> where <study_id> is an integer (Primary Key of the Study)
Accessible to: Researchers of the study
Data: Shows all studies with the following data for each: study ID, title, user types and researchers. Will also show the study groups in the study; which is a dictionary containing the study group ID, title and questions in each study group (which is a dictionary containing the info for each question along with the info of attempts for each question). That's a huge mouthful so have a screenshot 😛 :

image

Also generate fake data for Attempts when we run ./dev sampledata. This currently only generates a max of 1 attempt per question.

Note that for testing the 'researcher' for every study is the admin account.

TODO:

  • Allow all data for a particular study to be viewed at a single URL and......

  • only allow the researchers of this study to access this.

  • Adding researcher restriction currently duplicates queries - need to investigate if we can get away without doing this.

  • Try and remove 'profile' from attempt information, or make profile be a dictionary of user ID and email so we don't have duplicate info.

  • GET dropdown not working

  • Customise theme? 😛
    DARK MODE
    dab-squidward

@courtneycb courtneycb self-assigned this Sep 26, 2019
@courtneycb courtneycb marked this pull request as ready for review October 3, 2019 01:40
@caitlind
Copy link
Contributor

caitlind commented Oct 3, 2019

On all the pages when I select json from the drop down menu all the data loads fine, but the styling doesn't work. It's happening on firefox and chrome, no console error coming up on chrome though.
It doesn't affect the functionality though so maybe not a big issue?

Screenshot from 2019-10-04 10-47-24
Screenshot from 2019-10-04 10-47-59

@courtneycb
Copy link
Contributor Author

On all the pages when I select json from the drop down menu all the data loads fine, but the styling doesn't work. It's happening on firefox and chrome, no console error coming up on chrome though.
It doesn't affect the functionality though so maybe not a big issue?

Screenshot from 2019-10-04 10-47-24
Screenshot from 2019-10-04 10-47-59

This is supposed to be like this :)

@caitlind
Copy link
Contributor

caitlind commented Oct 4, 2019

This is supposed to be like this :)

Oops facepalm
In that case, everything looks good to me! :)

@courtneycb courtneycb merged commit 1f0f19f into develop Oct 6, 2019
@courtneycb courtneycb deleted the web-API branch October 6, 2019 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants