Skip to content

Commit

Permalink
Adicionada versão com modelo de dados pronto
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbarreiro committed Nov 28, 2023
1 parent 7ecfdf8 commit fa8034f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
20 changes: 12 additions & 8 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions app/controllers/student_attendance_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
class StudentAttendanceController < ApplicationController

def index
sa = StudentAttendance.where(attendance_id: params[:id])
render json: sa
end


def create
sa = StudentAttendance.new(student_attendance_params)
Expand Down
11 changes: 10 additions & 1 deletion app/controllers/student_courses_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
class StudentCoursesController < ApplicationController

def index
studentcourses = StudentCourse.where(course_id: params[:id])
studentlist = []
studentcourses.each { |stc|
student = Student.find(stc.student_id)
studentlist.append(student)
}
render json: studentlist
end

def show
studentcourses = StudentCourse.where(student_id: params[:id])
courselist = []
Expand All @@ -8,7 +18,6 @@ def show
course = Course.find(stc.course_id)
courselist.append(course)
}
print courselist
render json: courselist
end
end
Expand Down

0 comments on commit fa8034f

Please sign in to comment.