Skip to content

Commit

Permalink
Put radius to backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Frodo161 committed Nov 16, 2023
1 parent 97f9607 commit 2df9210
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/controllers/annotations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def update_annotations
end

def num_nearby_posted_mistake_annotations
annotations = Annotation.where(medium: params[:mediumId], category: 'mistake').commented
# the time (!) radius in which annotation are considered as "nearby"
radius = params[:radius].to_i
radius = 60
timestamp = params[:timestamp].to_i
annotations = Annotation.where(medium: params[:mediumId], category: 'mistake').commented
counter = annotations.to_a.count { |annotation| annotation.nearby?(timestamp, radius) }
render json: counter
end
Expand Down
2 changes: 0 additions & 2 deletions app/views/annotations/edit.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ function alertWarningMessage() {
function alertMistakeWarningMessage(message) {
message += "\n" + document.getElementById('annotation-locales').dataset.warningMistake;
var mediumId = thyme.dataset.medium;
var radius = 60; // annotations that are inside this radius (in seconds) are considered as "near".
$.ajax(Routes.num_nearby_posted_mistake_annotations_path(), {
type: 'GET',
dataType: 'json',
data: {
mediumId: mediumId,
timestamp: video.currentTime,
radius: radius,
},
success: function(count) {
if (!count) {
Expand Down

0 comments on commit 2df9210

Please sign in to comment.