I have two tables in my database which are relevant for this problem:
exercise_state with following fields:
| id | intensity_level | progress | exercise_id | user_id | current_date | user_rating |
auth_user with following fields:
| id | password | last_login | is_superuser | username | first_name | last_name | email | is_staff | is_active | date_joined |
Right now I am fetching some data in my view as follows:
def get_specific_exercise_finish_count(request, exerciseId):
# Number of users who completed a specific exercise
specific_exercise_finish_count = Exercise_state.objects.filter(exercise_id=exerciseId, intensity_level=7).count()
data = {}
data['count'] = specific_exercise_finish_count
return JSONResponse(data)
Now I want to filter those results further for specific set of usernames i.e. usernames those starts with 'yg_' (I have two sets of usernames registered in my system one group starts with 'yg' and the other with 'yg_'). As username is not a field of exercise_state, I am not sure how to proceed.
How can I achieve this?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)