app/controllers/home_controller.rb
# Returns a list of `StudentSectionAssignments` with low grades where
# the student hasn't been commented on in Insights yet.
# Somerville-only and SHS only.
# Response should include everything UI needs.
Returns a list of `StudentSectionAssignments` with low grades where
the student hasn't been commented on in Insights yet.
Somerville-only and SHS only.
Response should include everything UI needs.
Returns a list of ` StudentSectionAssignments ` with low grades where the student hasn ' t been commented on in Insights yet . Somerville - only and SHS only . Response should include everything UI needs .
def students_with_low_grades_json
    safe_params = params.permit(:educator_id, :time_now, :limit)
    educator = current_educator_or_doppleganger(safe_params[:educator_id])
    time_now = time_now_or_param(safe_params[:time_now])
    limit = safe_params[:limit].to_i
    time_threshold = time_now - 45.days
    grade_threshold = 69
    insight = InsightStudentsWithLowGrades.new(educator)
    students_with_low_grades_json = insight.students_with_low_grades_json(time_now, time_threshold, grade_threshold)
    render json: {
      limit: limit,
      total_count: students_with_low_grades_json.size,
      students_with_low_grades: students_with_low_grades_json.first(limit)
    }
  end
def students_with_low_grades_json safe_params = params . permit ( :educator_id , :time_now , :limit ) educator = current_educator_or_doppleganger ( safe_params [ :educator_id ] ) time_now = time_now_or_param ( safe_params [ :time_now ] ) limit = safe_params [ :limit ] . to_i time_threshold = time_now - 45 . days grade_threshold = 69 insight = InsightStudentsWithLowGrades . new ( educator ) students_with_low_grades_json = insight . students_with_low_grades_json ( time_now , time_threshold , grade_threshold ) render json : { limit : limit , total_count : students_with_low_grades_json . size , students_with_low_grades : students_with_low_grades_json . first ( limit ) } end
Returns a list of `StudentSectionAssignments` with low grades where
the student hasn't been commented on in Insights yet.
Returns a list of ` StudentSectionAssignments ` with low grades where the student hasn ' t been commented on in Insights yet .