Skip to content

Commit

Permalink
working with pmdk form
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSipayung committed Jan 25, 2024
1 parent 577f594 commit 05776f6
Show file tree
Hide file tree
Showing 42 changed files with 377 additions and 11 deletions.
16 changes: 16 additions & 0 deletions app/controllers/pmdk_each_score_informations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class PmdkEachScoreInformationsController < 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/pmdk_school_informations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class PmdkSchoolInformationsController < 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/pmdk_total_score_informations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class PmdkTotalScoreInformationsController < 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/pmdk_each_score_informations_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module PmdkEachScoreInformationsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/pmdk_school_informations_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module PmdkSchoolInformationsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/pmdk_total_score_informations_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module PmdkTotalScoreInformationsHelper
end
3 changes: 3 additions & 0 deletions app/models/pmdk_each_score_information.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class PmdkEachScoreInformation < ApplicationRecord
belongs_to :user
end
3 changes: 3 additions & 0 deletions app/models/pmdk_school_information.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class PmdkSchoolInformation < ApplicationRecord
belongs_to :user
end
3 changes: 3 additions & 0 deletions app/models/pmdk_total_score_information.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class PmdkTotalScoreInformation < ApplicationRecord
belongs_to :user
end
21 changes: 12 additions & 9 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ class User < ApplicationRecord
# assign an activation token and digest to each user
# before user created, using before_create callback
before_create :create_activation_digest
has_one :personal
has_one :source
has_one :parent
has_one :major
has_many :addresses
has_many :languages
has_many :achievements
has_many :extras
has_many :organizations
has_one :personal, dependent: :destroy
has_one :source, dependent: :destroy
has_one :parent, dependent: :destroy
has_one :major, dependent: :destroy
has_many :addresses, dependent: :destroy
has_many :languages, dependent: :destroy
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
#validates the user input
validates(:name, presence: true)
validates(:name, length: {maximum: 50})
Expand Down
2 changes: 2 additions & 0 deletions app/views/pmdk_each_score_informations/create.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkEachScoreInformations#create</h1>
<p>Find me in app/views/pmdk_each_score_informations/create.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_each_score_informations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkEachScoreInformations#edit</h1>
<p>Find me in app/views/pmdk_each_score_informations/edit.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_each_score_informations/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkEachScoreInformations#new</h1>
<p>Find me in app/views/pmdk_each_score_informations/new.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_each_score_informations/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkEachScoreInformations#show</h1>
<p>Find me in app/views/pmdk_each_score_informations/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_each_score_informations/update.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkEachScoreInformations#update</h1>
<p>Find me in app/views/pmdk_each_score_informations/update.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_school_informations/create.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkSchoolInformations#create</h1>
<p>Find me in app/views/pmdk_school_informations/create.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_school_informations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkSchoolInformations#edit</h1>
<p>Find me in app/views/pmdk_school_informations/edit.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_school_informations/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkSchoolInformations#new</h1>
<p>Find me in app/views/pmdk_school_informations/new.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_school_informations/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkSchoolInformations#show</h1>
<p>Find me in app/views/pmdk_school_informations/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_school_informations/update.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkSchoolInformations#update</h1>
<p>Find me in app/views/pmdk_school_informations/update.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_total_score_informations/create.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkTotalScoreInformations#create</h1>
<p>Find me in app/views/pmdk_total_score_informations/create.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_total_score_informations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkTotalScoreInformations#edit</h1>
<p>Find me in app/views/pmdk_total_score_informations/edit.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_total_score_informations/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkTotalScoreInformations#new</h1>
<p>Find me in app/views/pmdk_total_score_informations/new.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_total_score_informations/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkTotalScoreInformations#show</h1>
<p>Find me in app/views/pmdk_total_score_informations/show.html.erb</p>
2 changes: 2 additions & 0 deletions app/views/pmdk_total_score_informations/update.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>PmdkTotalScoreInformations#update</h1>
<p>Find me in app/views/pmdk_total_score_informations/update.html.erb</p>
6 changes: 5 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
resources :parent_job_lists
resources :high_school_majors
resources :major_lists

# get 'personals/new'
# get 'personals/update'
# get 'personals/edit'
Expand Down Expand Up @@ -73,7 +74,10 @@
resources :extras, only: [:new, :create, :edit, :update, :show]
resources :organizations, only: [:new, :create, :edit, :update, :show]
resources :sources, only: [:new, :create, :edit, :update, :show]
resources :majors, only: [:new, :create, :edit, :update, :show]
resources :majors, only: [:new, :create, :edit, :update, :show]

resources :pmdk_school_informations, only: [:new, :create, :edit, :update, :show]
resources :pmdk_each_score_informations, only: [:new, :create, :edit, :update, :show]
resources :pmdk_total_score_informations, only: [:new, :create, :edit, :update, :show]

end
12 changes: 12 additions & 0 deletions db/migrate/20240125022622_create_pmdk_school_informations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreatePmdkSchoolInformations < ActiveRecord::Migration[7.1]
def change
create_table :pmdk_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 AddUserRefToPmdkSchoolInformation < ActiveRecord::Migration[7.1]
def change
add_reference :pmdk_school_informations, :user, null: false, foreign_key: true
end
end
18 changes: 18 additions & 0 deletions db/migrate/20240125024340_create_pmdk_total_score_informations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class CreatePmdkTotalScoreInformations < ActiveRecord::Migration[7.1]
def change
create_table :pmdk_total_score_informations do |t|
t.numeric :jumlah_nilai_semester_1
t.numeric :jumlah_nilai_semester_2
t.numeric :jumlah_nilai_semester_3
t.numeric :jumlah_nilai_semester_4
t.numeric :jumlah_nilai_semester_5
t.numeric :jumlah_pelajaran_semester_1
t.numeric :jumlah_pelajaran_semester_2
t.numeric :jumlah_pelajaran_semester_3
t.numeric :jumlah_pelajaran_semester_4
t.numeric :jumlah_pelajaran_semester_5

t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddUserRefToPmdkTotalScoreInformation < ActiveRecord::Migration[7.1]
def change
add_reference :pmdk_total_score_informations, :user, null: false, foreign_key: true
end
end
31 changes: 31 additions & 0 deletions db/migrate/20240125025003_create_pmdk_each_score_informations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class CreatePmdkEachScoreInformations < ActiveRecord::Migration[7.1]
def change
create_table :pmdk_each_score_informations do |t|
t.numeric :matematika_semester_1
t.numeric :matematika_semester_2
t.numeric :matematika_semester_3
t.numeric :matematika_semester_4
t.numeric :matematika_semester_5

t.numeric :fisika_semester_1
t.numeric :fisika_semester_2
t.numeric :fisika_semester_3
t.numeric :fisika_semester_4
t.numeric :fisika_semester_5

t.numeric :kimia_semester_1
t.numeric :kimia_semester_2
t.numeric :kimia_semester_3
t.numeric :kimia_semester_4
t.numeric :kimia_semester_5

t.numeric :bahasa_inggris_semester_1
t.numeric :bahasa_inggris_semester_2
t.numeric :bahasa_inggris_semester_3
t.numeric :bahasa_inggris_semester_4
t.numeric :bahasa_inggris_semester_5

t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddUserRefToPmdkEachScoreInformation < ActiveRecord::Migration[7.1]
def change
add_reference :pmdk_each_score_informations, :user, null: false, foreign_key: true
end
end
60 changes: 59 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/pmdk_each_score_informations_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require "test_helper"

class PmdkEachScoreInformationsControllerTest < ActionDispatch::IntegrationTest
test "should get new" do
get pmdk_each_score_informations_new_url
assert_response :success
end

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

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

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

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

class PmdkSchoolInformationsControllerTest < ActionDispatch::IntegrationTest
test "should get new" do
get pmdk_school_informations_new_url
assert_response :success
end

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

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

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

test "should get show" do
get pmdk_school_informations_show_url
assert_response :success
end
end
Loading

0 comments on commit 05776f6

Please sign in to comment.