-
Notifications
You must be signed in to change notification settings - Fork 7
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
Keep track of sessions by user #132
Comments
@suhlrich I have a few questions. First of all, as I understand, we need to implement the API endpoint that allow to "mark" the given session as a "successful". That API endpoint will be used by
This part is not clear for me. Do you want the endpoint for bulk operation. Like
And the response would be like:
Where Do you need also some sort of endpoint for getting the list of successful sessions? Or, just adding the list filter to the Session section in the admin UI is enough? |
The We will also need an endpoint that gets a list of successful sessions ids for a user (doesn't need to return the whole session, just the id). Let's add a query parameter `just_n' that is false by default. If true, it returns just the number of successful sessions for the user, if false, it returns all of the session identifiers. |
@olehkorkh-planeks following up on your questions and making it a bit more general. Changing the plan a bit: let's just create a status field in the Session model and create an endpoint to change the status. Permissions: isAdmin, isBackend
In the Sessions model, default Question: when we migrate the database, the previous sessions will get the status field added with the default value, right? Answers to your questions:
Permissions: isAdmin, isBackend, isOwner
response. We just want the session id string, not the full session model.
|
Please check the PR https://github.com/stanfordnmbl/opencap-api/pull/156/files There are two endpoints: POST /sessions/get_session_statuses/ - returns session ids with a given status in the specified range ## session get_session_statuses
curl -X "POST" "http://localhost:8000/sessions/get_session_statuses/" \
-H 'Authorization: Token 8188103f9aa87cedda86587822db8c7ffbec01c2' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"status": "init",
"date_range": [
"2024-01-01",
"2024-01-24"
]
}' Response:
POST /sessions/...session_uuid.../set_session_status/ - set the status for the specified session ## session set_session_status Duplicate
curl -X "POST" "http://localhost:8000/sessions/5747af67-5eb9-4282-8215-4cccdef4082f/set_session_status/" \
-H 'Authorization: Token 8188103f9aa87cedda86587822db8c7ffbec01c2' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"status": "blah"
}' Response
|
We need a way to keep track of 'successful' sessions for each user - regardless of if they've deleted them or not. A successful session is when they've collected a trial that is not calibration or neutral, and its status==done.
Here's a way we could do it:
opencap-core: when a trial finishes processing a dynamic trial and status == done, we could do a POST
sessions/session_id/add_successful_session
opencap-api:
sessions/add_successful_session
checks some list for the user of successful sessions and adds the session if it doesn't yet exist.Open to other ideas, @olehkorkh-planeks
The text was updated successfully, but these errors were encountered: