Skip to content

Commit

Permalink
utbk form add
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSipayung committed Jan 25, 2024
1 parent 05776f6 commit 694a0e3
Show file tree
Hide file tree
Showing 29 changed files with 226 additions and 1 deletion.
16 changes: 16 additions & 0 deletions app/controllers/utbk_school_informations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class UtbkSchoolInformationsController < ApplicationController
def new
end

def update
end

def create
end

def edit
end

def show
end
end
16 changes: 16 additions & 0 deletions app/controllers/utbk_scores_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class UtbkScoresController < ApplicationController
def new
end

def update
end

def create
end

def edit
end

def show
end
end
2 changes: 2 additions & 0 deletions app/helpers/utbk_school_informations_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module UtbkSchoolInformationsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/utbk_scores_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module UtbkScoresHelper
end
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ class User < ApplicationRecord
has_many :achievements, dependent: :destroy
has_many :extras, dependent: :destroy
has_many :organizations, dependent: :destroy

has_one :pmdk_each_score_information, dependent: :destroy
has_one :pmdk_total_score_information, dependent: :destroy
has_one :pmdk_school_information, dependent: :destroy

has_one :utbk_score, dependent: :destroy
has_one :utbk_school_information, dependent: :destroy
#validates the user input
validates(:name, presence: true)
validates(:name, length: {maximum: 50})
Expand Down
3 changes: 3 additions & 0 deletions app/models/utbk_school_information.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class UtbkSchoolInformation < ApplicationRecord
belongs_to :user
end
3 changes: 3 additions & 0 deletions app/models/utbk_score.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class UtbkScore < ApplicationRecord
belongs_to :user
end
2 changes: 2 additions & 0 deletions app/views/utbk_school_informations/create.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>UtbkSchoolInformations#create</h1>
<p>Find me in app/views/utbk_school_informations/create.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/utbk_school_informations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>UtbkSchoolInformations#edit</h1>
<p>Find me in app/views/utbk_school_informations/edit.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/utbk_school_informations/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>UtbkSchoolInformations#new</h1>
<p>Find me in app/views/utbk_school_informations/new.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/utbk_school_informations/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>UtbkSchoolInformations#show</h1>
<p>Find me in app/views/utbk_school_informations/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/utbk_school_informations/update.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>UtbkSchoolInformations#update</h1>
<p>Find me in app/views/utbk_school_informations/update.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/utbk_scores/create.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>UtbkScores#create</h1>
<p>Find me in app/views/utbk_scores/create.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/utbk_scores/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>UtbkScores#edit</h1>
<p>Find me in app/views/utbk_scores/edit.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/utbk_scores/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>UtbkScores#new</h1>
<p>Find me in app/views/utbk_scores/new.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/utbk_scores/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>UtbkScores#show</h1>
<p>Find me in app/views/utbk_scores/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/utbk_scores/update.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>UtbkScores#update</h1>
<p>Find me in app/views/utbk_scores/update.html.erb</p>
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,6 @@
resources :pmdk_each_score_informations, only: [:new, :create, :edit, :update, :show]
resources :pmdk_total_score_informations, only: [:new, :create, :edit, :update, :show]

resources :utbk_scores, only: [:new, :create, :edit, :update, :show]
resources :utbk_school_informations, only: [:new, :create, :edit, :update, :show]
end
15 changes: 15 additions & 0 deletions db/migrate/20240125034604_create_utbk_scores.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class CreateUtbkScores < ActiveRecord::Migration[7.1]
def change
create_table :utbk_scores do |t|
t.string :no_peserta
t.date :tanggal_ujian
t.numeric :nilai_penalaran_umum
t.numeric :nilai_pengetahuan_kuantitatif
t.numeric :nilai_pengetahuan_dan_pemahaman_umum
t.numeric :nilai_kemampuan_memahami_bacaan_dan_menulis
t.numeric :jumlah_pelajaran_semester_6
t.numeric :jumlah_nilai_semester_6
t.timestamps
end
end
end
5 changes: 5 additions & 0 deletions db/migrate/20240125035257_add_user_ref_to_utbk_score.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddUserRefToUtbkScore < ActiveRecord::Migration[7.1]
def change
add_reference :utbk_scores, :user, null: false, foreign_key: true
end
end
12 changes: 12 additions & 0 deletions db/migrate/20240125035421_create_utbk_school_informations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateUtbkSchoolInformations < ActiveRecord::Migration[7.1]
def change
create_table :utbk_school_informations do |t|
t.string :asal_sekolah
t.string :akreditas
t.numeric :jumlah_pelajaran_un
t.numeric :jumlah_nilai_un

t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddUserRefToUtbkSchoolInformation < ActiveRecord::Migration[7.1]
def change
add_reference :utbk_school_informations, :user, null: false, foreign_key: true
end
end
30 changes: 29 additions & 1 deletion db/schema.rb

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

28 changes: 28 additions & 0 deletions test/controllers/utbk_school_informations_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require "test_helper"

class UtbkSchoolInformationsControllerTest < ActionDispatch::IntegrationTest
test "should get new" do
get utbk_school_informations_new_url
assert_response :success
end

test "should get update" do
get utbk_school_informations_update_url
assert_response :success
end

test "should get create" do
get utbk_school_informations_create_url
assert_response :success
end

test "should get edit" do
get utbk_school_informations_edit_url
assert_response :success
end

test "should get show" do
get utbk_school_informations_show_url
assert_response :success
end
end
28 changes: 28 additions & 0 deletions test/controllers/utbk_scores_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require "test_helper"

class UtbkScoresControllerTest < ActionDispatch::IntegrationTest
test "should get new" do
get utbk_scores_new_url
assert_response :success
end

test "should get update" do
get utbk_scores_update_url
assert_response :success
end

test "should get create" do
get utbk_scores_create_url
assert_response :success
end

test "should get edit" do
get utbk_scores_edit_url
assert_response :success
end

test "should get show" do
get utbk_scores_show_url
assert_response :success
end
end
13 changes: 13 additions & 0 deletions test/fixtures/utbk_school_informations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
asal_sekolah: MyString
akreditas: MyString
jumlah_pelajaran_un: MyString
jumlah_nilai_un: MyString

two:
asal_sekolah: MyString
akreditas: MyString
jumlah_pelajaran_un: MyString
jumlah_nilai_un: MyString
9 changes: 9 additions & 0 deletions test/fixtures/utbk_scores.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
no_peserta: MyString
tanggal_ujian: 2024-01-25

two:
no_peserta: MyString
tanggal_ujian: 2024-01-25
7 changes: 7 additions & 0 deletions test/models/utbk_school_information_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "test_helper"

class UtbkSchoolInformationTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
7 changes: 7 additions & 0 deletions test/models/utbk_score_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "test_helper"

class UtbkScoreTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit 694a0e3

Please sign in to comment.