Skip to content

Commit

Permalink
lint and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Jan 30, 2024
1 parent 366678a commit 75c6800
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions app/controllers/api/v1/books_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ def show

# Only return rateable judgements, filter out the unrateable ones.
# unique_raters = @book.judgements.rateable.preload(:user).collect(&:user).uniq
#unique_raters = @book.judges.merge(Judgement.rateable)
# unique_raters = @book.judges.merge(Judgement.rateable)
unique_judge_ids = @book.query_doc_pairs.joins(:judgements)
.distinct.pluck(:user_id)



# this logic about using email versus name is kind of awful. Think about user.full_name or user.identifier?
unique_judges = []
Expand All @@ -62,7 +60,7 @@ def show
end

@csv_array << csv_headers
query_doc_pairs = @book.query_doc_pairs.include(:judgements)
query_doc_pairs = @book.query_doc_pairs.includes(:judgements)
query_doc_pairs.each do |qdp|
row = [ make_csv_safe(qdp.query_text), qdp.doc_id ]
unique_judges.each do |judge|
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/snapshots_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def create

def destroy
SnapshotDoc.joins(snapshot_query: :snapshot)
.where(snapshot_queries: { snapshot: @snapshot })
.where(snapshot_queries: { snapshot: @snapshot })
.delete_all
@snapshot.snapshot_queries.delete_all
@snapshot.destroy
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/api/v1/books_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class BooksControllerTest < ActionController::TestCase

assert_response :ok
csv = CSV.parse(response.body, headers: true)
assert_includes csv.headers, 'Unknown'
assert_includes csv.headers, 'anonymous'
end
end
end
Expand Down

0 comments on commit 75c6800

Please sign in to comment.