Skip to content
This repository has been archived by the owner on Aug 12, 2018. It is now read-only.

Commit

Permalink
Merged?
Browse files Browse the repository at this point in the history
  • Loading branch information
ctevans committed Apr 1, 2016
1 parent f9df905 commit 917c337
Show file tree
Hide file tree
Showing 74 changed files with 1,993 additions and 689 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

Relevant documentation can be found in the [wiki](https://github.com/401ChemistryGenealogy/ChemistryGenealogy/wiki). Don't forget to check the 'pages' section on the right.


### E2E (End to end) Tests using Protractor:
https://github.com/401ChemistryGenealogy/ChemistryGenealogy/wiki/End-to-end-testing-using-Protractor!----A-Detailed-Guide-step-by-step-including-bugs

### auto-generated docs

These can be found [online](http://401chemistrygenealogy.github.io/) or in the [docs folder](https://github.com/401ChemistryGenealogy/ChemistryGenealogy/tree/master/backend/doc)
Expand Down
49 changes: 25 additions & 24 deletions backend/.yardoc/checksums
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
app/lib/search.rb 641aeb729fc6e5e1f4e9c317afc48f37b52f4a5a
app/lib/search.rb 8e3abf28f9a98d807ffb15948f3f2e1523852065
app/models/user.rb d3c9dedf945d625674077a30bf2f2cbb6409fdb1
app/lib/deleter.rb 553d75b0f6a214d49c53967ffd31f7b190a0a4b4
app/lib/find_id.rb 61a4c30ea5f784c42491d1ee09d5fa3a300ac284
app/lib/deleter.rb 35ea32167a4221c52c9149b7e3babebcef121db2
app/models/admin.rb 619c9860fd009f905a3c46c3d0d97d9fc7aa1e62
app/lib/verifier.rb 7f1f2e80ef565f0cb6998c8eed710a288343da1b
app/lib/notifier.rb a9f713a84d8fa05b20e88ae7a514e041dfb08807
app/models/degree.rb b997b7c6aa0433b8197e6a1c8dc8734f677339ed
app/lib/notifier.rb 923d38d8159a0d36074f722e5271a8694c2cb8cc
app/lib/verifier.rb 71dbc08b7a1a8599aeeb3d31442bffd97dacdac6
app/models/person.rb 02bf6a6a92f918964104359c94502aca19d6be90
app/models/degree.rb b997b7c6aa0433b8197e6a1c8dc8734f677339ed
app/models/mentor.rb d937e3fae7662242bb9d03879a8269cdd337940a
app/models/postdoc.rb 16d732aae82cd9407c5610967ef5b747fd2ef923
app/lib/auth_token.rb 4fe2ba5cc707a564a5da3709e6f81bb30bf3b82f
app/lib/information.rb ee4604cb12400fb0a0705a0e8660d82898582807
app/lib/find_detail.rb 1edc0d8e0562c51fe0a3f92cbd5eb40e19d8e815
app/lib/information.rb fc69764146c61f7a1dc9c946898255e43923c018
app/models/supervisor.rb 5e2529b6114b1edaf8316733a3ae2081a925c53b
app/models/mentorship.rb 636669725c94485d83231f55e585b499f90166ce
app/lib/auto_complete.rb af4a0eee76a76a6cb7a6474bba1887e8f929d3cf
app/lib/auto_complete.rb 77e7d9cb2854a17aaeaa8667919f2c6280f172b9
app/models/supervision.rb 237a0369fefdac62ad7ce20be912ae04c8865dfd
app/models/institution.rb 8897f5c4178f7308577a15acd329adf5abf87530
app/models/audit_trail.rb 0ce06729b003a9150ee8f5d019beca55abdb6a66
app/models/supervision.rb 237a0369fefdac62ad7ce20be912ae04c8865dfd
app/controllers/api_controller.rb 439079430f75c5ee36083463c9622caf5b76e1c0
app/controllers/auth_controller.rb f87eda4c62d55a8316476802d6866b17a18bc78d
app/controllers/user_controller.rb 279c1a49fd694ecb8316dd4894720d3b6828f72c
app/mailers/user_mailer.rb 2ec80c9dcad50a29363f289f4d4c94b012ced0e4
app/controllers/api_controller.rb 1f76bcbbf6a4c4f653a7c531518928586f4c70e0
app/serializers/user_serializer.rb 3e2275741192602828a96ed0bd399c2c4bc1f9f9
app/controllers/admin_controller.rb c766d1575bf70d3e6cfe63f5a96cb6fed1f3649e
app/controllers/auth_controller.rb f87eda4c62d55a8316476802d6866b17a18bc78d
app/controllers/user_controller.rb bf75f031170458d43cd25d08179ae8eb1ebd25d0
app/serializers/admin_serializer.rb ade50ceaf1d63c7f528fc887300b4aff58bef003
app/controllers/search_controller.rb 09f2930f31161dfabccd75bb32e1e23ac033eb5a
app/controllers/errors_controller.rb 2fde7d97e22d9e9a7655aa76cbefb06177d59aef
app/serializers/search_serializer.rb 6dc86c5cbc82b9c3d7748349c14aee4d0f05b668
app/controllers/api/people_controller.rb 5820c0f4ed3cd7afcd75494b2c15a54ce3acabd8
app/controllers/api/admins_controller.rb b176a597dad8e26790c4373478e002f3460bd5e0
app/controllers/errors_controller.rb 2fde7d97e22d9e9a7655aa76cbefb06177d59aef
app/controllers/admins_controller.rb 2d4abe358fe1a1dc2073f087862ed89cf7d9a46b
app/controllers/search_controller.rb 09f2930f31161dfabccd75bb32e1e23ac033eb5a
app/serializers/api/degree_serializer.rb d4e18e8637dfa7d61372ef5a3e80a2221e1d9d1e
app/serializers/api/person_serializer.rb 2bc7ff00c5442a3bae47499d04d3755001e807ed
app/controllers/application_controller.rb 50904503abc5d2481c22a8f0edda9c7ca90e8350
app/controllers/api/degrees_controller.rb ad31dd8b09048fb7b4b9146c19af54adbb1f0a3f
app/controllers/api/admins_controller.rb b176a597dad8e26790c4373478e002f3460bd5e0
app/controllers/api/people_controller.rb 5820c0f4ed3cd7afcd75494b2c15a54ce3acabd8
app/serializers/api/postdoc_serializer.rb 6ed5494af99bb1c2864452b842483fd598543a82
app/controllers/application_controller.rb a68303f475cbdd49091729d5c33dc513e822b773
app/controllers/api/degrees_controller.rb ad31dd8b09048fb7b4b9146c19af54adbb1f0a3f
app/controllers/auto_complete_controller.rb 202d7df112dcf6125ebb8fdabac92fbdaeb6b35f
app/controllers/api/aggregated_controller.rb 76b6e25a492a2c7983d6e43da12ddc443e330216
app/serializers/api/supervisor_serializer.rb 98a1de762611491b8e7047a980b1d3f066cc3992
app/serializers/api/mentorship_serializer.rb af6118d9abdbcba72206491b8e799d4260415c7a
app/controllers/api/mentorships_controller.rb f6432d45654930656cca8cc498534c5d7321c7c2
app/controllers/api/audit_trail_controller.rb 946558ff78057781001760dec6b9ccbcb22412a2
app/serializers/api/supervisor_serializer.rb 98a1de762611491b8e7047a980b1d3f066cc3992
app/controllers/api/aggregated_controller.rb 20f5e954caed9502a22b0b369e3162941c21135c
app/serializers/api/supervision_serializer.rb f0d83d20361f18a8f904a477c828a59d7fbb94b1
app/serializers/api/institution_serializer.rb 3c718fab8745eec7bbaaff7fda234dc2348fa82c
app/controllers/api/verification_controller.rb 30756a39440a5c2d39e3b6cd69df6aab979846a4
app/controllers/api/mentorships_controller.rb f6432d45654930656cca8cc498534c5d7321c7c2
app/controllers/api/audit_trail_controller.rb 946558ff78057781001760dec6b9ccbcb22412a2
app/controllers/api/supervisions_controller.rb 9b119c65b20ecfe893cc9002ff69cd7583e4d7c0
app/controllers/api/institutions_controller.rb 6299bb48caef66a71d9580065d7d8f04439a80b1
app/controllers/api/notification_controller.rb b076b8eaff36609753c36128a2ece398de4db7db
app/controllers/api/institutions_controller.rb 6299bb48caef66a71d9580065d7d8f04439a80b1
app/controllers/api/verification_controller.rb 30756a39440a5c2d39e3b6cd69df6aab979846a4
Binary file modified backend/.yardoc/object_types
Binary file not shown.
Binary file modified backend/.yardoc/objects/root.dat
Binary file not shown.
17 changes: 15 additions & 2 deletions backend/app/controllers/api/aggregated_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ def edit
# Handles submitting information about a person with POST
def create
Rails.logger.info(params)
@person = Information.submit_handling(params[:name], params[:position], params[:institution], params[:postdoc], params[:degree])
@person = Information.submit_handling(params[:name],
params[:position],
params[:institution],
params[:postdoc],
params[:degree],
params[:superdoc],
params[:superdeg])
if @person != nil && @person.save
render json: {person: @person}
else
Expand All @@ -50,7 +56,14 @@ def create
def update
Rails.logger.info(params)
Rails.logger.debug params.inspect
@person = Information.update_handling(params[:id], params[:name], params[:position], params[:institution], params[:postdoc], params[:degree])
@person = Information.update_handling(params[:id],
params[:name],
params[:position],
params[:institution],
params[:postdoc],
params[:degree],
params[:superdoc],
params[:superdeg])
if @person != nil && @person.save
render json: {person: @person}
else
Expand Down
56 changes: 44 additions & 12 deletions backend/app/lib/information.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,52 @@ class Information
# @param name [String] name of the person
# @param position [String] current position of the person
# @param institution_name [String] current institution of the person
# @param postdoc_array [Array<Hash{String => String, Number}>] array of the person's postdoc information
# @param degree_array [Array<Hash{String => String, Number}>] array of the person's degree information
# @param postdoc_array [Array<Hash{String => String, Number}>] array of the person's personal postdoc information
# @param degree_array [Array<Hash{String => String, Number}>] array of the person's personal degree information
# @param superdoc_array [Array<Hash{String => String, Number}>] array of the person's supervised postdocs
# @param superdeg_array [Array<Hash{String => String, Number}>] array of the person's supervised degrees
# @return [Hash{String} => String, Number] created person in the database
def Information.submit_handling(name, position, institution_name, postdoc_array, degree_array)
def Information.submit_handling(name, position, institution_name, postdoc_array, degree_array, superdoc_array, superdeg_array)

person = Person.new_person(name.downcase, position, institution_name)

# Checks that the postdoc_array is not null before adding new mentorships
unless postdoc_array.nil?
postdoc_array.each do |postdoc|
Mentorship.new_mentorship(name.downcase, postdoc[:pdSupervisor], postdoc[:pdInstitution],
postdoc[:pdStartYear], postdoc[:pdEndYear])
# Checks that the superdeg_array is not nil before adding the new person, degree, and supervisions as needed
unless superdeg_array.nil?
superdeg_array.each do |degree|
Person.new_person(degree[:superDegNameOfPerson], degree[:superDegCurrPosition], degree[:superDegCurrInst])
Degree.new_degree(degree[:superDegYear], degree[:superDegDegType], degree[:superDegInst])
Supervision.new_supervision(degree[:superDegYear],
degree[:superDegDegType],
degree[:superDegInst],
degree[:superDegNameOfPerson],
name)
end
end

# Checks that degree_array is not nil before adding new degrees and supervisions
unless degree_array.nil?
degree_array.each do |degree|
Degree.new_degree(degree[:year], degree[:type], degree[:institution])
Supervision.new_supervision(degree[:year], degree[:type], degree[:institution], name, degree[:supervisor])
Supervision.new_supervision(degree[:year], degree[:type], degree[:institution],
name, degree[:supervisor])
end
end


# Checks that the postdoc_array is not nil before adding new mentorships
unless postdoc_array.nil?
postdoc_array.each do |postdoc|
Mentorship.new_mentorship(name, postdoc[:pdSupervisor], postdoc[:pdInstitution],
postdoc[:pdStartYear], postdoc[:pdEndYear])
end
end

# Checks that the superdoc_array is not nil before adding the new mentorship
unless superdoc_array.nil?
superdoc_array.each do |postdoc|
Person.new_person(postdoc[:superDocNameOfPerson], nil, postdoc[:superDocInstitution])
Mentorship.new_mentorship(postdoc[:superDocNameOfPerson], name, postdoc[:superDocInstitution],
postdoc[:superDocStartYear], postdoc[:superDocEndYear])
end
end

Expand All @@ -39,10 +66,12 @@ def Information.submit_handling(name, position, institution_name, postdoc_array,
# @param name [String] name of the person
# @param position [String] current position of the person
# @param institution_name [String] current institution of the person
# @param postdoc_array [Array<Hash{String => String, Number}>] array of the person's postdoc information
# @param degree_array [Array<Hash{String => String, Number}>] array of the person's degree information
# @param postdoc_array [Array<Hash{String => String, Number}>] array of the person's personal postdoc information
# @param degree_array [Array<Hash{String => String, Number}>] array of the person's personal degree information
# @param superdoc_array [Array<Hash{String => String, Number}>] array of the person's supervised postdocs
# @param superdeg_array [Array<Hash{String => String, Number}>] array of the person's supervised degrees
# @return [Hash{String => String}] updated person
def Information.update_handling(id, name, position, institution_name, postdoc_array, degree_array)
def Information.update_handling(id, name, position, institution_name, postdoc_array, degree_array, superdoc_array, superdeg_array)

# Gets the person's information from the People table
person_object = Person.find(id)
Expand Down Expand Up @@ -74,7 +103,10 @@ def Information.update_handling(id, name, position, institution_name, postdoc_ar

# Update postdocs and degrees respectively
Mentorship.update_mentorship(id, name, postdoc_array)
Mentorship.update_superdoc(id, name, superdoc_array)
Supervision.update_supervision(id, name, degree_array)
Supervision.update_superdeg(id, name, superdeg_array)


# Updates person_object (not sure if we need this)
person_object = Person.find(id)
Expand Down
Loading

0 comments on commit 917c337

Please sign in to comment.