Skip to content

Commit

Permalink
Fix the srcoe disappear and test for new server
Browse files Browse the repository at this point in the history
  • Loading branch information
keweizhan committed Mar 12, 2024
1 parent d41ca62 commit 8e4531e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
8 changes: 0 additions & 8 deletions app/models/exercise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,6 @@ def latest_attempt_for(u)
def latest_parsons_attempt_for(external_id, current_user)
exercise_id = Exercise.find_by_external_id(external_id).id
# get the latest attempt for the exercise
if exercise_id.nil?
# if the exercise id does not exist,return an error message
return "Exercise does not exist"
end
if current_user.nil?
# if the user does not exist, return an error message
return "User does not exist"
end
attempt = Attempt.find_by(exercise_version_id: exercise_id, user_id: current_user.id)
return attempt
end
Expand Down
7 changes: 1 addition & 6 deletions app/views/exercises/_exercise.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@

- pts = workout ? workout.exercise_workouts.where(exercise: exercise).first.andand.points : nil
- is_parsons = exercise.name.downcase.include?('parsons')
- if is_parsons && user
- puts "Exercise external_id: #{exercise.external_id}, User: #{user.inspect}"
- if is_parsons
- attempt = exercise.latest_parsons_attempt_for(exercise.external_id,user)
- score = attempt ? attempt.score : 0
- puts "Attempt: #{attempt.inspect}, Score: #{score}"
- elsif !is_parsons
- attempt = workout_score ? workout_score.scoring_attempt_for(exercise) : exercise.latest_attempt_for(user)
- score = attempt ? attempt.score : 0
- else
- attempt = workout_score ? workout_score.scoring_attempt_for(exercise) : exercise.latest_attempt_for(user)
- score = attempt ? attempt.score : 0
Expand Down

0 comments on commit 8e4531e

Please sign in to comment.