diff --git a/README.md b/README.md index 9c0e1ef..0b5c6be 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/backend/.yardoc/checksums b/backend/.yardoc/checksums index d8121cf..59a506a 100644 --- a/backend/.yardoc/checksums +++ b/backend/.yardoc/checksums @@ -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 diff --git a/backend/.yardoc/object_types b/backend/.yardoc/object_types index c4244ce..7ceb803 100644 Binary files a/backend/.yardoc/object_types and b/backend/.yardoc/object_types differ diff --git a/backend/.yardoc/objects/root.dat b/backend/.yardoc/objects/root.dat index 1fb040f..070db6f 100644 Binary files a/backend/.yardoc/objects/root.dat and b/backend/.yardoc/objects/root.dat differ diff --git a/backend/app/controllers/api/aggregated_controller.rb b/backend/app/controllers/api/aggregated_controller.rb index 956d545..ca6e530 100644 --- a/backend/app/controllers/api/aggregated_controller.rb +++ b/backend/app/controllers/api/aggregated_controller.rb @@ -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 @@ -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 diff --git a/backend/app/lib/information.rb b/backend/app/lib/information.rb index da591fb..7d6f47d 100644 --- a/backend/app/lib/information.rb +++ b/backend/app/lib/information.rb @@ -7,17 +7,25 @@ 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 String, Number}>] array of the person's postdoc information - # @param degree_array [Array String, Number}>] array of the person's degree information + # @param postdoc_array [Array String, Number}>] array of the person's personal postdoc information + # @param degree_array [Array String, Number}>] array of the person's personal degree information + # @param superdoc_array [Array String, Number}>] array of the person's supervised postdocs + # @param superdeg_array [Array 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 @@ -25,7 +33,26 @@ def Information.submit_handling(name, position, institution_name, postdoc_array, 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 @@ -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 String, Number}>] array of the person's postdoc information - # @param degree_array [Array String, Number}>] array of the person's degree information + # @param postdoc_array [Array String, Number}>] array of the person's personal postdoc information + # @param degree_array [Array String, Number}>] array of the person's personal degree information + # @param superdoc_array [Array String, Number}>] array of the person's supervised postdocs + # @param superdeg_array [Array 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) @@ -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) diff --git a/backend/app/models/mentorship.rb b/backend/app/models/mentorship.rb index 78e53a9..7777558 100644 --- a/backend/app/models/mentorship.rb +++ b/backend/app/models/mentorship.rb @@ -32,130 +32,241 @@ def Mentorship.new_mentorship(person_name, mentor_name, institution_name, start_ end # Updates the mentorships connected to a person. - # @note Currently uses a quick-fix. Will hopefully update later. + # @note Since the postdocs themselves cannot be edited, this will only update the postdocs connected to a person # # @param id [Number] id of the person mentored # @param person_name [String] name of the person mentored # @param mentorship_array_received [Array String, Number}>] array of the person's postdoc information def Mentorship.update_mentorship(id, person_name, mentorship_array_received) + # Make an array of mentorship ids that are connected to the person in the database + mentorship_array = Array.new + mentorship_list = Mentorship.where(:person_id => id) + mentorship_list.each do |mentorship_single| + mentorship_array.push(mentorship_single.id) + end + + # Check that the mentorship array is not nil + unless mentorship_array.nil? + + # Check that the mentorship_array_received is not nil + unless mentorship_array_received.nil? + + # For each mentorship in the mentorship_array_received, + # see if it already exists in the database + # IF so, then the mentorship is present and can be removed from the mentorship_array + # as well as the mentorship_array_received + mentorship_array_received.each do |mentorship| + if mentorship.has_key?(:id) + mentorship_array.delete(mentorship[:id]) + mentorship_array_received.delete(mentorship) + end + end + + # The results left are ones that were either deleted or new + # Check if mentorship_array is not empty + unless mentorship_array.empty? + + # Check if the mentorship_array_received is not empty + unless mentorship_array_received.empty? + + # For each of the ids left in the array, update them with a new postdoc information + mentorship_array.each do |mentorship_id| + unless mentorship_array_received.empty? + new_mentorship = mentorship_array_received[0] + mentor_id = FindId.person(new_mentorship[:pdSupervisor]) + institution_id = FindId.institution(new_mentorship[:pdInstitution]) + Mentorship.update(mentorship_id, mentor_id: mentor_id) + Mentorship.update(mentorship_id, institution_id: institution_id) + Mentorship.update(mentorship_id, start: new_mentorship[:pdStartYear]) + Mentorship.update(mentorship_id, end: new_mentorship[:pdEndYear]) + + mentorship_array.delete(mentorship_id) + mentorship_array_received.delete(new_mentorship) + end + end + + # If there are any mentorships left in the mentorship_array, delete them + unless mentorship_array.empty? + mentorship_array.each do |mentorship_id| + Mentorship.delete(mentorship_id) + end + end + + # If there are any mentorships left in the mentorship_array_received, create them + unless mentorship_array_received.empty? + mentorship_array_received.each do |mentorship| + Mentorship.new_mentorship(person_name, + mentorship[:pdSupervisor], + mentorship[:pdInstitution], + mentorship[:pdStartYear], + mentorship[:pdEndYear]) + end + end + + # If the mentorship_array_received is empty, + # then the rest of the mentorships connected to the person are removed from the database + else + mentorship_array.each do |mentorship_id| + Mentorship.delete(mentorship_id) + end + end + # If it is empty, add remaining mentorships to the database + else + unless mentorship_array_received.empty? + mentorship_array_received.each do |mentorship| + Mentorship.new_mentorship(person_name, + mentorship[:pdSupervisor], + mentorship[:pdInstitution], + mentorship[:pdStartYear], + mentorship[:pdEndYear]) + end + end + end + + # If the mentorship_array_received is nil (or the person no longer has mentorships), + # then all mentorships connected to the person are removed from the database + else + mentorship_array.each do |mentorship_id| + Mentorship.delete(mentorship_id) + end + end + + # If mentorship_array is nil (or person has no mentorships), + # then if mentorship_array_received (or the mentorships received from edit page) + # is not nil, then add all of them to the table + # These should just be using the same format as a new postdoc + else + unless mentorship_array_received.nil? + mentorship_array_received.each do |mentorship| + Mentorship.new_mentorship(person_name, + mentorship[:pdSupervisor], + mentorship[:pdInstitution], + mentorship[:pdStartYear], + mentorship[:pdEndYear]) + end + end + end + end + + # Updates the mentorships that the person supervised. + # @note This could probably be combined with Mentorship.update_mentorship + # + # @param id [Number] id of the person mentored + # @param person_name [String] name of the person mentored + # @param mentorship_array_received [Array String, Number}>] array of the person's postdoc information + def Mentorship.update_superdoc(id, person_name, mentorship_array_received) + # Make an array of mentorship ids that are connected to the person in the database mentorship_array = Array.new - mentorship_list = Mentorship.where(:person_id => id) + mentorship_list = Mentorship.where(:mentor_id => id) mentorship_list.each do |mentorship_single| mentorship_array.push(mentorship_single.id) end - # Check that mentorship_array is not nil + # Check that the mentorship array is not nil unless mentorship_array.nil? - # Check that mentorship_array_received is not nil + # Check that the mentorship_array_received is not nil unless mentorship_array_received.nil? - # For each mentorship in the mentorship_array_received, see if it - # already exists in the database - # If it exists, don't do anything. If not, create it. + # For each mentorship in the mentorship_array_received, + # see if it already exists in the database + # IF so, then the mentorship is present and can be removed from the mentorship_array + # as well as the mentorship_array_received mentorship_array_received.each do |mentorship| - - # Reminder that this function will find or create a mentorship with - # the required attributes - mentorship_object = Mentorship.new_mentorship(person_name, - mentorship[:pdSupervisor], - mentorship[:pdInstitution], - mentorship[:pdStartYear], - mentorship[:pdEndYear]) - mentorship_id = mentorship_object.id - - # If the mentorship is in the mentorship_array, remove from the array - if mentorship_array.include? mentorship_id - mentorship_array.delete(mentorship_id) + if mentorship.has_key?(:id) + mentorship_array.delete(mentorship[:id]) + mentorship_array_received.delete(mentorship) end end - # If there's anything left in the mentorship_array after, remove them - unless mentorship_array.nil? - mentorship_array.each do |mentorship_id| - Mentorship.delete(mentorship_id) + # The results left are ones that were either deleted or new + # Check if mentorship_array is not empty + unless mentorship_array.empty? + + # Check if the mentorship_array_received is not empty + unless mentorship_array_received.empty? + + # For each of the ids left in the array, update them with a new postdoc information + mentorship_array.each do |mentorship_id| + unless mentorship_array_received.empty? + new_mentorship = mentorship_array_received[0] + mentored_id = FindId.person(new_mentorship[:superDocNameOfPerson]) + institution_id = FindId.institution(new_mentorship[:superDocInstitution]) + Mentorship.update(mentorship_id, person_id: mentored_id) + Mentorship.update(mentorship_id, institution_id: institution_id) + Mentorship.update(mentorship_id, start: new_mentorship[:superDocStartYear]) + Mentorship.update(mentorship_id, end: new_mentorship[:superDocEndYear]) + + mentorship_array.delete(mentorship_id) + mentorship_array_received.delete(new_mentorship) + end + end + + # If there are any mentorships left in the mentorship_array, delete them + unless mentorship_array.empty? + mentorship_array.each do |mentorship_id| + Mentorship.delete(mentorship_id) + end + end + + # If there are any mentorships left in the mentorship_array_received, create them + unless mentorship_array_received.empty? + mentorship_array_received.each do |mentorship| + Mentorship.new_mentorship(mentorship[:superDocNameOfPerson], + person_name, + mentorship[:superDocInstitution], + mentorship[:superDocStartYear], + mentorship[:superDocEndYear]) + end + end + + # If the mentorship_array_received is empty, + # then the rest of the mentorships connected to the person are removed from the database + else + mentorship_array.each do |mentorship_id| + Mentorship.delete(mentorship_id) + end + end + # If mentorship_array empty, add remaining mentorships to the database + else + unless mentorship_array_received.empty? + mentorship_array_received.each do |mentorship| + Mentorship.new_mentorship(mentorship[:superDocNameOfPerson], + person_name, + mentorship[:superDocInstitution], + mentorship[:superDocStartYear], + mentorship[:superDocEndYear]) + end end end - # If the mentorship_array_received is nil, remove all mentorships - # connected to the person + # If the mentorship_array_received is nil (or the person no longer has mentorships they supervised), + # then all mentorships connected to the person are removed from the database else mentorship_array.each do |mentorship_id| Mentorship.delete(mentorship_id) end end - # If mentorship_array is nil (or person has no mentorships), + # If mentorship_array is nil (or person has no mentorships they supervised), # then if mentorship_array_received (or the mentorships received from edit page) # is not nil, then add all of them to the table + # These should just be using the same format as a new postdoc else unless mentorship_array_received.nil? mentorship_array_received.each do |mentorship| - Mentorship.new_mentorship(person_name, - mentorship[:pdSupervisor], - mentorship[:pdInstitution], - mentorship[:pdStartYear], - mentorship[:pdEndYear]) + Mentorship.new_mentorship(mentorship[:superDocNameOfPerson], + person_name, + mentorship[:superDocInstitution], + mentorship[:superDocStartYear], + mentorship[:superDocEndYear]) end end end end - # # Check that mentorship_array is not nil - # unless mentorship_array.nil? - # - # # Check that mentorship_array_received is not nil - # unless mentorship_array_received.nil? - # - # # For each mentorship in the mentorship_array_received, see if it - # # already exists in the database - # # If it exists, update it. If not, create it. - # mentorship_array_received.each do |mentorship| - # - # # mentorship[:postdoc_id] should be set to nil if it is a new mentorship - # # Maybe this instead: if mentorship_array.include? mentorship[:postdoc_id] - # unless mentorship[:postdoc_id].nil? - # - # # Person_id should still stay the same. Everything else is updated. - # # *There's probably a nicer way of updating all info at once* - # mentor_id = FindId.person(mentorship[:pdSupervisor]) - # institution_id = FindId.institution(mentorship[:pdInstitution]) - # Mentorship.update(mentorship[:postdoc_id], mentor_id: mentor_id) - # Mentorship.update(mentorship[:postdoc_id], institution_id: institution_id) - # Mentorship.update(mentorship[:postdoc_id], start: mentorship[:pdStartYear]) - # Mentorship.update(mentorship[:postdoc_id], end: mentorship[:pdEndYear]) - # - # # Remove id from the mentorship_array - # mentorship_array.delete(mentorship[:postdoc_id]) - # - # # If the mentorship is not in the array, it is a new mentorship that - # # must be added (the mentorship[:postdoc_id] should be nil) - # else - # Mentorship.new_mentorship(person_name, - # mentorship[:pdSupervisor], - # mentorship[:pdInstitution], - # mentorship[:pdStartYear], - # mentorship[:pdEndYear]) - # end - # end - # - # # If there's anything left in the mentorship_array after, remove them - # unless mentorship_array.nil? - # mentorship_array.each do |mentorship_id| - # Mentorship.delete(mentorship_id) - # end - # end - # - # - # - # - # end - # end - # end - # end - # Makes a serialized postdoc to be sent to the frontend in a JSON format. # @note Could probably take id off if the frontend isn't using it # @@ -168,6 +279,7 @@ def serializer_for_mentorship(mentorship) result[:pdEndYear] = mentorship.end result[:pdSupervisor] = Person.find_by(id: mentorship.mentor_id).name result[:pdInstitution] = Institution.find_by(id: mentorship.institution_id).name + result[:pdSupervised] = Person.find_by(id: mentorship.person_id).name result = result.except(:id, :approved) result[:postdoc_id] = mentorship.id result[:postdoc_approved] = mentorship.approved diff --git a/backend/app/models/supervision.rb b/backend/app/models/supervision.rb index d714bd0..fcd5c16 100644 --- a/backend/app/models/supervision.rb +++ b/backend/app/models/supervision.rb @@ -33,7 +33,7 @@ def Supervision.new_supervision(degree_year, end # Updates the supervisions and degrees that the person has - # @note Currently uses a quick-fix. Will hopefully actually update later. + # @note Since the supervisions themselves cannot be edited, this will only update the supervisions connected to a person # # @param id [Number] id of the person # @param name [String] name of the person @@ -54,29 +54,75 @@ def Supervision.update_supervision(id, name, supervision_array_received) # Check that the supervision_array_received is not nil unless supervision_array_received.nil? - # For each supervision, see if it already exists in the database - # If not, create a new one + # For each supervision in the supervision_array_received, + # see if it already exists in the database + # If so, then the supervision is present and can be removed from the supervision_array + # as well as the supervision_array_received supervision_array_received.each do |supervision| - - # This function will find or create a supervision given the required - # attributes. It will also create a new degree if needed. - supervision_object = Supervision.new_supervision(supervision[:year], - supervision[:type], - supervision[:institution], - name, - supervision[:supervisor],) - supervision_id = supervision_object.id - - # If the supervision is in the supervision_array, remove from the array - if supervision_array.include? supervision_id - supervision_array.delete(supervision_id) + if supervision.has_key?(:id) + supervision_array.delete(supervision[:id]) + supervision_array_received.delete(supervision) end end - # If there are any supervisions left in supervision_array, delete them - unless supervision_array.nil? - supervision_array.each do |supervision_id| - Supervision.delete(supervision_id) + # The results left are ones that were either deleted or new + # Check if supervision_array is not empty + unless supervision_array.empty? + + # Check if the supervision_array_received is not empty + unless supervision_array_received.empty? + + # For each of the ids left in the array, update them with a new supervision information + supervision_array.each do |supervision_id| + unless supervision_array_received.empty? + new_supervision = supervision_array_received[0] + supervisor_id = FindId.person(new_supervision[:supervisor]) + degree_id = FindId.degree(new_supervision[:year], new_supervision[:type], new_supervision[:institution]) + Supervision.update(supervision_id, supervisor_id: supervisor_id) + Supervision.update(supervision_id, degree_id: degree_id) + + supervision_array.delete(supervision_id) + supervision_array_received.delete(new_supervision) + end + end + + # If there are any supervisions left in the supervision_array, delete them + unless supervision_array.empty? + supervision_array.each do |supervision_id| + Supervision.delete(supervision_id) + end + end + + # If there are any supervisions left in the supervision_array_received, create them + unless supervision_array_received.empty? + supervision_array_received.each do |supervision| + Degree.new_degree(supervision[:year], supervision[:type], supervision[:institution]) + Supervision.new_supervision(supervision[:year], + supervision[:type], + supervision[:institution], + name, + supervision[:supervisor]) + end + end + + # If the supervision_array_received is empty, + # then the rest of the supervisions connected to the person are removed from the database + else + supervision_array.each do |supervision_id| + Supervision.delete(supervision_id) + end + end + # If supervision_array is empty, add remaining supervisions to the database + else + unless supervision_array_received.empty? + supervision_array_received.each do |supervision| + Degree.new_degree(supervision[:year], supervision[:type], supervision[:institution]) + Supervision.new_supervision(supervision[:year], + supervision[:type], + supervision[:institution], + name, + supervision[:supervisor]) + end end end @@ -91,8 +137,6 @@ def Supervision.update_supervision(id, name, supervision_array_received) # If there are no supervisions connected to the person, create new # supervisions and degrees for the person as long as supervision_array_received # is not nil either - # In this case, degree_id, degree_approved, supervision_id, and supervision_approved - # are all nil else unless supervision_array_received.nil? supervision_array_received.each do |supervision| @@ -105,56 +149,142 @@ def Supervision.update_supervision(id, name, supervision_array_received) end end end + end + + # Updates the supervisions and degrees that the person has supervised + # @note @note This could probably be combined with Supervision.update_supervision + # + # @param id [Number] id of the person + # @param name [String] name of the person + # @param supervision_array_received [Array String, Number}>] array of supervisions that the person has supervised + def Supervision.update_superdeg(id, name, supervision_array_received) + + # Creates an array of supervision ids that are connected to the person in + # the database + supervision_array = Array.new + supervision_find = Supervision.where(:supervisor_id => id) + supervision_find.each do |single| + supervision_array.push(single.id) + end + + # Check that supervision_array is not nil + unless supervision_array.nil? - # # For each supervision in the supervision_array_received, check if it - # # exists in the supervision_array. - # # If so, then update. If not, create a new supervision and degree - # supervision_array_received.each do |supervision| - # - # # If the supervision is new, then the supervision[:supervision_id] - # # should be nil - # # Maybe this as well: if supervision_array.include? supervision[:supervision_id] - # unless supervision[:supervision_id].nil? - # - # # Check if the supervisor has changed. If so, then get new id. - # # Gets the supervision object and the supervisor person object - # # from the database to compare - # # See if there's a matching supervisor in the database and update - # # if it's not the same - # supervisor_id = FindId.person(supervision[:supervisor]) - # supervision_object = Supervision.find(supervision[:supervision_id]) - # if supervision_object.person_id != supervisor_id - # Supervision.update(supervision[:supervision_id], supervisor_id: supervisor_id) - # end - # - # # Find or create the degree id from the database - # # If it is not the same as supervision[:degree_id], then update - # # supervision with the new id - # # * Since multiple people may have the same degree, it may be best - # # not to update the degree in the database * - # degree_id = FindId.degree(supervision[:year], - # supervision[:type], - # supervision[:institution]) - # if degree_id != supervision[:degree_id] - # Supervision.update(supervision[:supervision_id], degree_id: degree_id) - # end - # - # # Remove id from the supervision_array - # supervision_array.delete(supervision[:supervision_id]) - # - # # If the supervision[:supervision_id] is nil, then it is new so create - # # a new supervision and degree - # else - # Degree.new_degree(supervision[:year], supervision[:type], supervision[:institution]) - # Supervision.new_supervision(supervision[:year], - # supervision[:type], - # supervision[:institution], - # name, - # supervision[:supervisor]) - # end - # end + # Check that the supervision_array_received is not nil + unless supervision_array_received.nil? + # For each supervision in the supervision_array_received, + # see if it already exists in the database + # If so, then the supervision is present and can be removed from the supervision_array + # as well as the supervision_array_received + supervision_array_received.each do |supervision| + if supervision.has_key?(:id) + supervision_array.delete(supervision[:id]) + supervision_array_received.delete(supervision) + end + end + # The results left are ones that were either deleted or new + # Check if supervision_array is not empty + unless supervision_array.empty? + + # Check if the supervision_array_received is not empty + unless supervision_array_received.empty? + + # For each of the ids left in the array, update them with a new supervision information + supervision_array.each do |supervision_id| + unless supervision_array_received.empty? + new_supervision = supervision_array_received[0] + supervised_id = FindId.person(new_supervision[:superDegNameOfPerson]) + degree_id = FindId.degree(new_supervision[:superDegYear], + new_supervision[:superDegDegType], + new_supervision[:superDegInst]) + Supervision.update(supervision_id, person_id: supervised_id) + Supervision.update(supervision_id, degree_id: degree_id) + + supervision_array.delete(supervision_id) + supervision_array_received.delete(new_supervision) + end + end + + # If there are any supervisions left in the supervision_array, delete them + unless supervision_array.empty? + supervision_array.each do |supervision_id| + Supervision.delete(supervision_id) + end + end + + # If there are any supervisions left in the supervision_array_received, create them + unless supervision_array_received.empty? + supervision_array_received.each do |supervision| + Person.new_person(supervision[:superDegNameOfPerson], + supervision[:superDegCurrPosition], + supervision[:superDegCurrInst]) + Degree.new_degree(supervision[:superDegYear], + supervision[:superDegDegType], + supervision[:superDegInst]) + Supervision.new_supervision(supervision[:superDegYear], + supervision[:superDegDegType], + supervision[:superDegInst], + supervision[:superDegNameOfPerson], + name) + end + end + + # If the supervision_array_received is empty, + # then the rest of the supervisions connected to the person are removed from the database + else + supervision_array.each do |supervision_id| + Supervision.delete(supervision_id) + end + end + # If it is empty, add remaining supervisions to the database + else + unless supervision_array_received.empty? + supervision_array_received.each do |supervision| + Person.new_person(supervision[:superDegNameOfPerson], + supervision[:superDegCurrPosition], + supervision[:superDegCurrInst]) + Degree.new_degree(supervision[:superDegYear], + supervision[:superDegDegType], + supervision[:superDegInst]) + Supervision.new_supervision(supervision[:superDegYear], + supervision[:superDegDegType], + supervision[:superDegInst], + supervision[:superDegNameOfPerson], + name) + end + end + end + + # If the supervision_array_received is nil (person has no degrees/supervisions) + # Then delete all supervisions in the supervision_array + else + supervision_array.each do |supervision_id| + Supervision.delete(supervision_id) + end + end + + # If there are no supervisions connected to the person, create new + # supervisions and degrees for the person as long as supervision_array_received + # is not nil either + else + unless supervision_array_received.nil? + supervision_array_received.each do |supervision| + Person.new_person(supervision[:superDegNameOfPerson], + supervision[:superDegCurrPosition], + supervision[:superDegCurrInst]) + Degree.new_degree(supervision[:superDegYear], + supervision[:superDegDegType], + supervision[:superDegInst]) + Supervision.new_supervision(supervision[:superDegYear], + supervision[:superDegDegType], + supervision[:superDegInst], + supervision[:superDegNameOfPerson], + name) + end + end + end end # Makes a serialized supervision with degree information to be sent to the frontend in a JSON format. @@ -167,9 +297,10 @@ def serializer_for_supervision(supervision) degree = Degree.find_by(id: degree_id) result[:year] = degree.year - result[:supervisor] = Person.find_by(:id => supervision.supervisor_id).name + result[:supervisor] = Person.find_by(id: supervision.supervisor_id).name result[:institution] = Institution.find_by(id: degree.institution_id).name result[:type] = degree.degree_type + result[:supervised] = Person.find_by(id: supervision.person_id).name result[:degree_id] = degree.id result[:degree_approved] = degree.approved diff --git a/backend/doc/AccessDeniedError.html b/backend/doc/AccessDeniedError.html index 007de02..ba0185d 100644 --- a/backend/doc/AccessDeniedError.html +++ b/backend/doc/AccessDeniedError.html @@ -114,9 +114,9 @@ diff --git a/backend/doc/Admin.html b/backend/doc/Admin.html index f817d77..d78a839 100644 --- a/backend/doc/Admin.html +++ b/backend/doc/Admin.html @@ -183,9 +183,9 @@

diff --git a/backend/doc/AdminSerializer.html b/backend/doc/AdminSerializer.html index d0d02cb..fed5282 100644 --- a/backend/doc/AdminSerializer.html +++ b/backend/doc/AdminSerializer.html @@ -114,9 +114,9 @@ diff --git a/backend/doc/AdminsController.html b/backend/doc/AdminsController.html new file mode 100644 index 0000000..fbf60e2 --- /dev/null +++ b/backend/doc/AdminsController.html @@ -0,0 +1,297 @@ + + + + + + Class: AdminsController + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

Class: AdminsController + + + +

+ +
+ +
Inherits:
+
+ ApplicationController + + + show all + +
+ + + + + + + + + +
Defined in:
+
app/controllers/admins_controller.rb
+ +
+
+ + + + + + + +

Instance Attribute Summary

+ +

Attributes inherited from ApplicationController

+

#current_user

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) create + + + + + +

+ + + + +
+
+
+
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+
+
# File 'app/controllers/admins_controller.rb', line 17
+
+def create
+  if params.has_key?(:user_id)
+    if User.exists?('id' => params[:user_id])
+      @admin = Admin.create(user_id: params[:user_id], approved: true)
+      render json: {created_admin: @admin}, status: 200
+      return
+    end
+    render json: {error: 'user does not exist'}, status:  :bad_request
+    return
+  end
+  render json: {error: 'user does not exist'}, status: :bad_request
+end
+
+
+ +
+

+ + - (Object) index + + + + + +

+ + + + +
+
+
+
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+
+
# File 'app/controllers/admins_controller.rb', line 2
+
+def index
+  @admins = Admin.where('approved' => true)
+            .includes(:user)
+
+  @response_array = Array.new
+  @admins.each do |a|
+    @response_hash = {
+      'data' => a,
+      'user' => a.user
+    }
+    @response_array.push(@response_hash)
+  end
+  render json: @response_array.to_json, status: 200
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/backend/doc/Api/AdminsController.html b/backend/doc/Api/AdminsController.html index 0602b13..6752d6e 100644 --- a/backend/doc/Api/AdminsController.html +++ b/backend/doc/Api/AdminsController.html @@ -495,9 +495,9 @@

diff --git a/backend/doc/Api/AggregatedController.html b/backend/doc/Api/AggregatedController.html index b64b721..a2dbb0d 100644 --- a/backend/doc/Api/AggregatedController.html +++ b/backend/doc/Api/AggregatedController.html @@ -354,18 +354,18 @@

 
 
-34
-35
-36
-37
 38
 39
 40
 41
-42
+42 +43 +44 +45 +46 -
# File 'app/controllers/api/aggregated_controller.rb', line 34
+      
# File 'app/controllers/api/aggregated_controller.rb', line 38
 
 def create
   Rails.logger.info(params)
@@ -396,12 +396,12 @@ 

 
 
-57
-58
-59
+61 +62 +63

-
# File 'app/controllers/api/aggregated_controller.rb', line 57
+      
# File 'app/controllers/api/aggregated_controller.rb', line 61
 
 def destroy
 	render json: {warning: 'not implemented'}, status: 200
@@ -426,12 +426,12 @@ 

 
 
-29
-30
-31
+33 +34 +35

-
# File 'app/controllers/api/aggregated_controller.rb', line 29
+      
# File 'app/controllers/api/aggregated_controller.rb', line 33
 
 def edit
   render json: {warning: 'not implemented'}, status: 200
@@ -498,12 +498,12 @@ 

 
 
-25
-26
-27
+29 +30 +31

-
# File 'app/controllers/api/aggregated_controller.rb', line 25
+      
# File 'app/controllers/api/aggregated_controller.rb', line 29
 
 def new
   render json: {warning: 'not implemented'}, status: 200
@@ -528,12 +528,12 @@ 

 
 
-61
-62
-63
+65 +66 +67

-
# File 'app/controllers/api/aggregated_controller.rb', line 61
+      
# File 'app/controllers/api/aggregated_controller.rb', line 65
 
 def notify_admin
   render json: {warning: 'not implemented'}, status: 200
@@ -585,16 +585,24 @@ 

20 21 22 -23

+23 +24 +25 +26 +27
# File 'app/controllers/api/aggregated_controller.rb', line 15
 
 def show
-  if params.has_key?(:id)
-    @person = Search.person(params[:id])
+  Rails.logger.info(params)
+  if params.has_key?(:id) && params.has_key?(:approved)
+    @person = Search.person(params[:id], params[:approved])
+    render :json => @person.to_json
+  elsif params.has_key?(:id)
+    @person = Search.person(params[:id], nil)
     render :json => @person.to_json
-  elsif
+  else
     render json: {warning: 'expected id param'}, status: 200
   end
 
@@ -631,19 +639,19 @@ 

 
 
-46
-47
-48
-49
 50
 51
 52
 53
 54
-55
+55 +56 +57 +58 +59

-
# File 'app/controllers/api/aggregated_controller.rb', line 46
+      
# File 'app/controllers/api/aggregated_controller.rb', line 50
 
 def update
   Rails.logger.info(params)
@@ -665,9 +673,9 @@ 

diff --git a/backend/doc/Api/AuditTrailController.html b/backend/doc/Api/AuditTrailController.html index 5fe5fe3..546410f 100644 --- a/backend/doc/Api/AuditTrailController.html +++ b/backend/doc/Api/AuditTrailController.html @@ -417,9 +417,9 @@

diff --git a/backend/doc/Api/DegreeSerializer.html b/backend/doc/Api/DegreeSerializer.html index bb964d6..ee9e133 100644 --- a/backend/doc/Api/DegreeSerializer.html +++ b/backend/doc/Api/DegreeSerializer.html @@ -125,9 +125,9 @@

Overview

diff --git a/backend/doc/Api/DegreesController.html b/backend/doc/Api/DegreesController.html index 732ba0b..2ed0279 100644 --- a/backend/doc/Api/DegreesController.html +++ b/backend/doc/Api/DegreesController.html @@ -552,9 +552,9 @@

diff --git a/backend/doc/Api/InstitutionSerializer.html b/backend/doc/Api/InstitutionSerializer.html index d7eeec0..e7a1de5 100644 --- a/backend/doc/Api/InstitutionSerializer.html +++ b/backend/doc/Api/InstitutionSerializer.html @@ -125,9 +125,9 @@

Overview

diff --git a/backend/doc/Api/InstitutionsController.html b/backend/doc/Api/InstitutionsController.html index 48abdc4..093df59 100644 --- a/backend/doc/Api/InstitutionsController.html +++ b/backend/doc/Api/InstitutionsController.html @@ -540,9 +540,9 @@

diff --git a/backend/doc/Api/MentorshipSerializer.html b/backend/doc/Api/MentorshipSerializer.html index be83c9e..ceba03d 100644 --- a/backend/doc/Api/MentorshipSerializer.html +++ b/backend/doc/Api/MentorshipSerializer.html @@ -125,9 +125,9 @@

Overview

diff --git a/backend/doc/Api/MentorshipsController.html b/backend/doc/Api/MentorshipsController.html index f3030ba..d1a3079 100644 --- a/backend/doc/Api/MentorshipsController.html +++ b/backend/doc/Api/MentorshipsController.html @@ -552,9 +552,9 @@

diff --git a/backend/doc/Api/NotificationController.html b/backend/doc/Api/NotificationController.html index 7c5389b..8a7a035 100644 --- a/backend/doc/Api/NotificationController.html +++ b/backend/doc/Api/NotificationController.html @@ -214,9 +214,9 @@

diff --git a/backend/doc/Api/PeopleController.html b/backend/doc/Api/PeopleController.html index 7ac009a..6578e56 100644 --- a/backend/doc/Api/PeopleController.html +++ b/backend/doc/Api/PeopleController.html @@ -558,9 +558,9 @@

diff --git a/backend/doc/Api/PersonSerializer.html b/backend/doc/Api/PersonSerializer.html index 2548ff3..e673323 100644 --- a/backend/doc/Api/PersonSerializer.html +++ b/backend/doc/Api/PersonSerializer.html @@ -125,9 +125,9 @@

Overview

diff --git a/backend/doc/Api/PostdocSerializer.html b/backend/doc/Api/PostdocSerializer.html index 8143160..709cadd 100644 --- a/backend/doc/Api/PostdocSerializer.html +++ b/backend/doc/Api/PostdocSerializer.html @@ -125,9 +125,9 @@

Overview

diff --git a/backend/doc/Api/SupervisionSerializer.html b/backend/doc/Api/SupervisionSerializer.html index d6b96a6..71b4243 100644 --- a/backend/doc/Api/SupervisionSerializer.html +++ b/backend/doc/Api/SupervisionSerializer.html @@ -127,9 +127,9 @@

Overview

diff --git a/backend/doc/Api/SupervisionsController.html b/backend/doc/Api/SupervisionsController.html index b73ead8..d0c5ccf 100644 --- a/backend/doc/Api/SupervisionsController.html +++ b/backend/doc/Api/SupervisionsController.html @@ -562,9 +562,9 @@

diff --git a/backend/doc/Api/VerificationController.html b/backend/doc/Api/VerificationController.html index e57a4c0..9301e1e 100644 --- a/backend/doc/Api/VerificationController.html +++ b/backend/doc/Api/VerificationController.html @@ -640,9 +640,9 @@

diff --git a/backend/doc/ApiController.html b/backend/doc/ApiController.html index e43bebc..01f58a5 100644 --- a/backend/doc/ApiController.html +++ b/backend/doc/ApiController.html @@ -159,9 +159,9 @@

Attributes inherited from diff --git a/backend/doc/ApplicationController.html b/backend/doc/ApplicationController.html index 44a899d..0414633 100644 --- a/backend/doc/ApplicationController.html +++ b/backend/doc/ApplicationController.html @@ -130,7 +130,7 @@

Overview

@@ -227,9 +227,9 @@

diff --git a/backend/doc/AuditTrail.html b/backend/doc/AuditTrail.html index 3a1c6f8..667d065 100644 --- a/backend/doc/AuditTrail.html +++ b/backend/doc/AuditTrail.html @@ -114,9 +114,9 @@ diff --git a/backend/doc/AuthController.html b/backend/doc/AuthController.html index 90fc29b..c7fa2f0 100644 --- a/backend/doc/AuthController.html +++ b/backend/doc/AuthController.html @@ -234,9 +234,9 @@

diff --git a/backend/doc/AuthToken.html b/backend/doc/AuthToken.html index 7d2e575..ecc34d4 100644 --- a/backend/doc/AuthToken.html +++ b/backend/doc/AuthToken.html @@ -302,9 +302,9 @@

diff --git a/backend/doc/AuthenticationTimeoutError.html b/backend/doc/AuthenticationTimeoutError.html index b49b671..45e4b33 100644 --- a/backend/doc/AuthenticationTimeoutError.html +++ b/backend/doc/AuthenticationTimeoutError.html @@ -114,9 +114,9 @@ diff --git a/backend/doc/AutoComplete.html b/backend/doc/AutoComplete.html index b3c9ee2..5d35e97 100644 --- a/backend/doc/AutoComplete.html +++ b/backend/doc/AutoComplete.html @@ -212,14 +212,14 @@

 
 
-15
-16
 17
 18
-19
+19 +20 +21

-
# File 'app/lib/auto_complete.rb', line 15
+      
# File 'app/lib/auto_complete.rb', line 17
 
 def self.find_institutions(institution)
   @institution = "%#{institution}%".downcase
@@ -251,14 +251,18 @@ 

10 11 12 -13

+13 +14 +15
# File 'app/lib/auto_complete.rb', line 8
 
 def self.find_names(name)
   @name = "%#{name}%".downcase
-  @response = Person.where("name LIKE ?", @name).includes(:institution)
+  @response = Person.where("name LIKE ?", @name)
+                    .where('approved' => true)
+                    .includes(:institution)
   @institutions = Set.new
   return @response
 end
@@ -272,9 +276,9 @@

diff --git a/backend/doc/AutoCompleteController.html b/backend/doc/AutoCompleteController.html index f88da7f..d08f644 100644 --- a/backend/doc/AutoCompleteController.html +++ b/backend/doc/AutoCompleteController.html @@ -218,9 +218,9 @@

diff --git a/backend/doc/Degree.html b/backend/doc/Degree.html index d3c59d6..528b4fd 100644 --- a/backend/doc/Degree.html +++ b/backend/doc/Degree.html @@ -371,9 +371,9 @@

diff --git a/backend/doc/Deleter.html b/backend/doc/Deleter.html index 5279d1b..1050e2b 100644 --- a/backend/doc/Deleter.html +++ b/backend/doc/Deleter.html @@ -405,7 +405,7 @@

# File 'app/lib/deleter.rb', line 49
 
 def self.delete_person(person_id)
-  @person = Search.person_info(person_id)
+  @person = Search.person_info(person_id, false)
 
   @person["person"].mentorships.each do |m|
     m.destroy
@@ -518,9 +518,9 @@ 

diff --git a/backend/doc/ErrorsController.html b/backend/doc/ErrorsController.html index 10e3e68..b010f89 100644 --- a/backend/doc/ErrorsController.html +++ b/backend/doc/ErrorsController.html @@ -224,9 +224,9 @@

diff --git a/backend/doc/FindDetail.html b/backend/doc/FindDetail.html index 5fa8bc6..3719dd9 100644 --- a/backend/doc/FindDetail.html +++ b/backend/doc/FindDetail.html @@ -318,9 +318,9 @@

diff --git a/backend/doc/FindId.html b/backend/doc/FindId.html index cec2d3e..47aa7fa 100644 --- a/backend/doc/FindId.html +++ b/backend/doc/FindId.html @@ -648,9 +648,9 @@

diff --git a/backend/doc/Information.html b/backend/doc/Information.html index 60d1813..72ac095 100644 --- a/backend/doc/Information.html +++ b/backend/doc/Information.html @@ -344,12 +344,12 @@

# File 'app/lib/information.rb', line 13
 
 def Information.submit_handling(name, position, institution_name, postdoc_array, degree_array)
-  person = Person.new_person(name, position, institution_name)
+  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, postdoc[:pdSupervisor], postdoc[:pdInstitution],
+      Mentorship.new_mentorship(name.downcase, postdoc[:pdSupervisor], postdoc[:pdInstitution],
         postdoc[:pdStartYear], postdoc[:pdEndYear])
     end
   end
@@ -572,7 +572,7 @@ 

# Checks if the name is the same. If not, change it. unless name.nil? if person_object.name != name - Person.update(id, name: name) + Person.update(id, name: name.downcase) end end @@ -611,9 +611,9 @@

diff --git a/backend/doc/Institution.html b/backend/doc/Institution.html index 5c7a0c8..031e203 100644 --- a/backend/doc/Institution.html +++ b/backend/doc/Institution.html @@ -333,9 +333,9 @@

diff --git a/backend/doc/Mentor.html b/backend/doc/Mentor.html index 60826d4..112f45e 100644 --- a/backend/doc/Mentor.html +++ b/backend/doc/Mentor.html @@ -125,9 +125,9 @@

Overview

diff --git a/backend/doc/Mentorship.html b/backend/doc/Mentorship.html index e74104c..36289dd 100644 --- a/backend/doc/Mentorship.html +++ b/backend/doc/Mentorship.html @@ -791,9 +791,9 @@

diff --git a/backend/doc/NotAuthenticatedError.html b/backend/doc/NotAuthenticatedError.html index 7fa3f33..0bfa4d2 100644 --- a/backend/doc/NotAuthenticatedError.html +++ b/backend/doc/NotAuthenticatedError.html @@ -114,9 +114,9 @@ diff --git a/backend/doc/Notifier.html b/backend/doc/Notifier.html index 861a5e3..d88d2bd 100644 --- a/backend/doc/Notifier.html +++ b/backend/doc/Notifier.html @@ -422,6 +422,7 @@

 
 
+28
 29
 30
 31
@@ -436,11 +437,10 @@ 

40 41 42 -43 -44

+43

-
# File 'app/lib/notifier.rb', line 29
+      
# File 'app/lib/notifier.rb', line 28
 
 def self.admin_notifications
   @unapproved_admins = Admin.where({:approved => false})
@@ -489,6 +489,7 @@ 

 
 
+6
 7
 8
 9
@@ -496,11 +497,10 @@ 

11 12 13 -14 -15

+14

-
# File 'app/lib/notifier.rb', line 7
+      
# File 'app/lib/notifier.rb', line 6
 
 def self.all_notifications
   return {
@@ -673,6 +673,7 @@ 

 
 
+79
 80
 81
 82
@@ -698,11 +699,10 @@ 

102 103 104 -105 -106

+105

-
# File 'app/lib/notifier.rb', line 80
+      
# File 'app/lib/notifier.rb', line 79
 
 def self.mentorship_notifications
   @unapproved_mentorships = Mentorship.where({:approved => false})
@@ -750,7 +750,7 @@ 

this method will bundle all relationships + information w.r.t. an unapproved person. This reflects a person that was just added to the -database.

+database. TODO: refactor and fold with Search.person_info

@@ -978,6 +978,7 @@

 
 
+47
 48
 49
 50
@@ -1005,11 +1006,10 @@ 

72 73 74 -75 -76

+75

-
# File 'app/lib/notifier.rb', line 48
+      
# File 'app/lib/notifier.rb', line 47
 
 def self.supervision_notifications
   @unapproved_supervisions = Supervision.where({:approved => false})
@@ -1145,6 +1145,7 @@ 

 
 
+17
 18
 19
 20
@@ -1152,11 +1153,10 @@ 

22 23 24 -25 -26

+25

-
# File 'app/lib/notifier.rb', line 18
+      
# File 'app/lib/notifier.rb', line 17
 
 def self.user_notifications
   @unapproved_users = User.where({:approved => false})
@@ -1177,9 +1177,9 @@ 

diff --git a/backend/doc/Person.html b/backend/doc/Person.html index d4ae7b2..bd0188b 100644 --- a/backend/doc/Person.html +++ b/backend/doc/Person.html @@ -554,9 +554,9 @@

diff --git a/backend/doc/Postdoc.html b/backend/doc/Postdoc.html index adf9a62..d0b27d2 100644 --- a/backend/doc/Postdoc.html +++ b/backend/doc/Postdoc.html @@ -125,9 +125,9 @@

Overview

diff --git a/backend/doc/Search.html b/backend/doc/Search.html index 2b7480e..e88998e 100644 --- a/backend/doc/Search.html +++ b/backend/doc/Search.html @@ -149,7 +149,7 @@

  • - + (Object) person(id) + + (Object) person(id, approved) @@ -259,7 +259,7 @@

    Class Method Details

    - + (Object) person(id) + + (Object) person(id, approved) @@ -270,8 +270,7 @@

    this class is different from relations_by_id, because it not only gathers the relations, but also the information required to “fill” out these -relations. used to detail or “view” a person on the frontend. TODO: take -out the begining of the function and call self.person_info instead.

    +relations. used to detail or “view” a person on the frontend.

    @@ -285,13 +284,6 @@

     
     
    -109
    -110
    -111
    -112
    -113
    -114
    -115
     116
     117
     118
    @@ -382,101 +374,222 @@ 

    203 204 205 -206

    +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270

  • -
    # File 'app/lib/search.rb', line 109
    +      
    # File 'app/lib/search.rb', line 116
     
    -def self.person(id)
    +def self.person(id, approved)
       unless Person.exists?(id) then return nil end
    +  @person_info = self.person_info(id)
    +  if @person_info["person"] == nil
    +    return nil
    +  end
     
    -  @person = Person.includes(:institution)
    -            .includes( {mentorships: [:institution, {mentor: [:institution]}] })
    -            .includes( {supervisions: [ {degree:  [:institution] }, {supervisor: [:institution]}] })
    -            .where(:id => id).first
    -
    -  @mentored = Mentorship.where(:mentor_id => id)
    -              .includes(:institution)
    -              .includes(person: :institution)
    -
    -  @supervised = Supervision.where(:supervisor_id => id)
    -                .includes(degree: :institution)
    -                .includes(person: :institution)
    -
    +  # be warned: the following nested if-elsif statements are ugly as sin
    +  # but i'm experiencing a bug and don't have time for elegance
    +
    +  # TODO: the problem is that the approved value is a string and not a boolean
    +  # so, write a helper method that returns true/false depending on the value
    +  # of the string and then use the returned boolean value to query database
    +  # instead of these nested if/elsif blocks of nasty
    +
       @mentorships_array = Array.new
    -  unless @person.mentorships.blank?
    -    @person.mentorships.each do |m|
    -      @mentorship = {
    -        'id' => m.id,
    -        'start' => m.start,
    -        'end' => m.end,
    -        'institution' => m.institution,
    -        'mentor' => {
    -          'data' => m.mentor,
    -          'institution' => m.mentor.institution
    +  unless @person_info["person"].mentorships.blank?
    +    @person_info["person"].mentorships.each do |m|
    +      if m.approved && approved == 'true'
    +        @mentorship = {
    +          'id' => m.id,
    +          'start' => m.start,
    +          'end' => m.end,
    +          'institution' => m.institution,
    +          'mentor' => {
    +            'data' => m.mentor,
    +            'institution' => m.mentor.institution
    +          }
    +        }
    +        @mentorships_array.push(@mentorship)
    +      elsif approved == 'false'
    +        @mentorship = {
    +          'id' => m.id,
    +          'start' => m.start,
    +          'end' => m.end,
    +          'institution' => m.institution,
    +          'mentor' => {
    +            'data' => m.mentor,
    +            'institution' => m.mentor.institution
    +          }
             }
    -      }
    -      @mentorships_array.push(@mentorship)
    +        @mentorships_array.push(@mentorship)
    +      end
         end
       end
     
       @supervision_array = Array.new
    -  unless @person.supervisions.blank?
    -    @person.supervisions.each do |s|
    -      @supervision = {
    -        'id' => s.id,
    -        'degree' => {
    -          'data' => s.degree,
    -          'institution' => s.degree.institution
    -        },
    -        'supervisor' => {
    -          'person' => s.supervisor,
    -          'institution' => s.supervisor.institution
    +  unless @person_info["person"].supervisions.blank?
    +     @person_info["person"].supervisions.each do |s|
    +      if s.approved && approved == 'true'
    +        @supervision = {
    +          'id' => s.id,
    +          'degree' => {
    +            'data' => s.degree,
    +            'institution' => s.degree.institution
    +          },
    +          'supervisor' => {
    +            'person' => s.supervisor,
    +            'institution' => s.supervisor.institution
    +          }
             }
    -      }
    -      @supervision_array.push(@supervision)
    +        @supervision_array.push(@supervision)
    +      elsif approved == 'false'
    +        @supervision = {
    +          'id' => s.id,
    +          'degree' => {
    +            'data' => s.degree,
    +            'institution' => s.degree.institution
    +          },
    +          'supervisor' => {
    +            'person' => s.supervisor,
    +            'institution' => s.supervisor.institution
    +          }
    +        }
    +        @supervision_array.push(@supervision)
    +      end
         end
       end
     
       @mentored_array = Array.new
    -  unless @mentored.blank?
    -    @mentored.each do |m|
    -      @mentored_obj = {
    -        'id' => m.id,
    -        'start' => m.start,
    -        'end' => m.end,
    -        'institution' => m.institution,
    -        'mentored' => {
    -          'person' => m.person,
    -          'institution' => m.person.institution
    +  unless @person_info["mentored"].blank?
    +    @person_info["mentored"].each do |m|
    +      if m.approved && approved == 'true'
    +        @mentored_obj = {
    +          'id' => m.id,
    +          'start' => m.start,
    +          'end' => m.end,
    +          'institution' => m.institution,
    +          'mentored' => {
    +            'person' => m.person,
    +            'institution' => m.person.institution
    +            }
               }
    -        }
    -      @mentored_array.push(@mentored_obj)
    +        @mentored_array.push(@mentored_obj)
    +      elsif approved == 'false'
    +        @mentored_obj = {
    +          'id' => m.id,
    +          'start' => m.start,
    +          'end' => m.end,
    +          'institution' => m.institution,
    +          'mentored' => {
    +            'person' => m.person,
    +            'institution' => m.person.institution
    +            }
    +          }
    +        @mentored_array.push(@mentored_obj)
    +      end
         end
       end
     
       @supervised_array = Array.new
    -  unless @supervised.blank?
    -    @supervised.each do |s|
    -      @supervised_obj = {
    -        'id' => s.id,
    -        'degree' => {
    -          'data' => s.degree,
    -          'institution' => s.degree.institution
    -        },
    -        'person' => {
    -          'data' => s.person,
    -          'institution' => s.person.institution
    +  unless @person_info["supervised"].blank?
    +    @person_info["supervised"].each do |s|
    +      if s.approved && approved == 'true'
    +        @supervised_obj = {
    +          'id' => s.id,
    +          'degree' => {
    +            'data' => s.degree,
    +            'institution' => s.degree.institution
    +          },
    +          'person' => {
    +            'data' => s.person,
    +            'institution' => s.person.institution
    +          }
             }
    -      }
    -      @supervised_array.push(@supervised_obj)
    +        @supervised_array.push(@supervised_obj)
    +      elsif approved == 'false'
    +        @supervised_obj = {
    +          'id' => s.id,
    +          'degree' => {
    +            'data' => s.degree,
    +            'institution' => s.degree.institution
    +          },
    +          'person' => {
    +            'data' => s.person,
    +            'institution' => s.person.institution
    +          }
    +        }
    +        @supervised_array.push(@supervised_obj)
    +      end
         end
       end
     
       @data = {
         'person' => {
    -      'data' => @person,
    -      'institution' => @person.institution
    +      'data' => @person_info["person"],
    +      'institution' => @person_info["person"].institution
         },
         'mentors' => @mentorships_array,
         'mentored' => @mentored_array,
    @@ -503,7 +616,8 @@ 

    this function was extracted from self.person(id) and is called by Notifier -and Deleter. It is used to retrieve the relationships w.r.t

    +and Deleter. It is used to retrieve the relationships w.r.t if approved == +nil then we will gather all information, good for notifications

    @@ -550,15 +664,6 @@

     
     
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
     91
     92
     93
    @@ -571,14 +676,21 @@ 

    100 101 102 -103

    +103 +104 +105 +106 +107 +108 +109 +110 +111

    -
    # File 'app/lib/search.rb', line 82
    +      
    # File 'app/lib/search.rb', line 91
     
     def self.person_info(id)
       unless Person.exists?(id) then return nil end
    -
       @person = Person.includes(:institution)
                 .includes( {mentorships: [:institution, {mentor: [:institution]}] })
                 .includes( {supervisions: [ {degree:  [:institution] }, {supervisor: [:institution]}] })
    @@ -616,8 +728,8 @@ 

    returns a hash that contains the relations to a person and the -person/institution records. it is used in conjunction with autocomplete on -the frontend, and it is likely that this class can be optimized TODO: +person/institution records. it is used in conjunction with search on the +frontend, and it is likely that this class can be optimized TODO: investigate optimizations

    @@ -683,7 +795,15 @@

    73 74 75 -76

    +76 +77 +78 +79 +80 +81 +82 +83 +84
    # File 'app/lib/search.rb', line 25
    @@ -706,23 +826,31 @@ 

    end @mentors = Person.joins('LEFT OUTER JOIN mentorships ON mentorships.mentor_id = people.id') - .where('mentorships.person_id' => person_id).where('approved' => true) + .where('mentorships.person_id' => person_id) + .where('approved' => true) + .where('mentorships.approved' => true) .includes(:institution) unless @mentors.blank? then @persons.add(@mentors) end @mentored = Person.joins(:mentorships) - .where('mentorships.mentor_id' => person_id).where('approved' => true) + .where('mentorships.mentor_id' => person_id) + .where('approved' => true) + .where('mentorships.approved' => true) .includes(:institution) unless @mentored.blank? then @persons.add(@mentored) end @supervisors = Person.joins('LEFT OUTER JOIN supervisions ON supervisions.supervisor_id = people.id') - .where('supervisions.person_id' => person_id).where('approved' => true) + .where('supervisions.person_id' => person_id) + .where('approved' => true) + .where('supervisions.approved' => true) .includes(:institution) unless @supervisors.blank? then @persons.add(@supervisors) end @supervised = Person.joins(:supervisions) - .where('supervisions.supervisor_id' => person_id).where('approved' => true) + .where('supervisions.supervisor_id' => person_id) + .where('approved' => true) + .where('supervisions.approved' => true) .includes(:institution) unless @supervised.blank? then @persons.add(@supervised) end @@ -800,9 +928,9 @@

    diff --git a/backend/doc/SearchController.html b/backend/doc/SearchController.html index 4371bba..b9c0c53 100644 --- a/backend/doc/SearchController.html +++ b/backend/doc/SearchController.html @@ -243,9 +243,9 @@

    diff --git a/backend/doc/SearchSerializer.html b/backend/doc/SearchSerializer.html index 5938c81..9fbcfc5 100644 --- a/backend/doc/SearchSerializer.html +++ b/backend/doc/SearchSerializer.html @@ -114,9 +114,9 @@ diff --git a/backend/doc/Supervision.html b/backend/doc/Supervision.html index 6c24c50..f2dfdb9 100644 --- a/backend/doc/Supervision.html +++ b/backend/doc/Supervision.html @@ -909,9 +909,9 @@

    diff --git a/backend/doc/Supervisor.html b/backend/doc/Supervisor.html index 2370133..84efc15 100644 --- a/backend/doc/Supervisor.html +++ b/backend/doc/Supervisor.html @@ -125,9 +125,9 @@

    Overview

    diff --git a/backend/doc/User.html b/backend/doc/User.html index 6c202ef..877e2e6 100644 --- a/backend/doc/User.html +++ b/backend/doc/User.html @@ -331,9 +331,9 @@

    diff --git a/backend/doc/UserController.html b/backend/doc/UserController.html index d5ccf22..610e04f 100644 --- a/backend/doc/UserController.html +++ b/backend/doc/UserController.html @@ -213,7 +213,9 @@

    -
    +
    +

    TODO: make less sloppy (joins etc).

    +
    @@ -304,24 +306,24 @@

     
     
    -12
    -13
    -14
    -15
    -16
    -17
    -18
    -19
     20
     21
     22
     23
     24
     25
    -26
    +26 +27 +28 +29 +30 +31 +32 +33 +34

    -
    # File 'app/controllers/user_controller.rb', line 12
    +      
    # File 'app/controllers/user_controller.rb', line 20
     
     def create
       Rails.logger.info(params)
    @@ -358,15 +360,33 @@ 

     
     
    -36
    -37
    -38
    +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55

    -
    # File 'app/controllers/user_controller.rb', line 36
    +      
    # File 'app/controllers/user_controller.rb', line 44
     
     def destroy
    -  render json: {warning: 'not implemented'}, status: 200
    +  if params.has_key?(:id)
    +    if User.exists?('id' => params[:id])
    +      User.find(params[:id]).destroy
    +      render json: {user_destroyed: params[:id]}, status: 200
    +      return
    +    end
    +    render json: {user_not_exist: params[:id]}, status: 200
    +  else
    +    render json: {error: 'insufficient params'}, status: :bad_request
    +  end
     end
    @@ -382,21 +402,46 @@

    -

    +
    +
    + +

    TODO: make less sloppy (joins etc)

    + + +
    +
    +
    + + +
    @@ -418,12 +463,12 @@

     
     
    -28
    -29
    -30
    +36 +37 +38

     
     
    -6
     7
    -8
    +8 +9 +10 +11 +12 +13 +14 +15 +16
    -
    # File 'app/controllers/user_controller.rb', line 6
    +      
    # File 'app/controllers/user_controller.rb', line 7
     
     def index
    -  render json: {warning: 'not implemented'}, status: 200
    +  @admins = Admin.where('approved' => true)
    +  @user_ids = Array.new
    +  @admins.each do |a|
    +    @user_ids.push(a.user_id)
    +  end
    +  @users = User.where('approved' => true)
    +           .where.not('id' => @user_ids)
    +  render json: @users, status: 200
     end
    -
    # File 'app/controllers/user_controller.rb', line 28
    +      
    # File 'app/controllers/user_controller.rb', line 36
     
     def show
       render json: {warning: 'not implemented'}, status: 200
    @@ -448,12 +493,12 @@ 

     
     
    -32
    -33
    -34
    +40 +41 +42

    -
    # File 'app/controllers/user_controller.rb', line 32
    +      
    # File 'app/controllers/user_controller.rb', line 40
     
     def update
       render json: {warning: 'not implemented'}, status: 200
    @@ -468,9 +513,9 @@ 

    diff --git a/backend/doc/UserMailer.html b/backend/doc/UserMailer.html new file mode 100644 index 0000000..6cbb429 --- /dev/null +++ b/backend/doc/UserMailer.html @@ -0,0 +1,239 @@ + + + + + + Class: UserMailer + + — Documentation by YARD 0.8.7.6 + + + + + + + + + + + + + + + + + + + + + +

    Class: UserMailer + + + +

    + +
    + +
    Inherits:
    +
    + ActionMailer::Base + +
      +
    • Object
    • + + + + + +
    + show all + +
    + + + + + + + + + +
    Defined in:
    +
    app/mailers/user_mailer.rb
    + +
    +
    + +

    Overview

    +
    + +

    This mailer is used to notify a user that registered that their account has +been approved. NOTE: this is not fully implemented due to lack of +requirment, so you should view this as a starting point for extending the +application.

    + + +
    +
    +
    + +

    Author:

    +
      + +
    • + + + + + +
      +

      Steven Myers

      +
      + +
    • + +
    + +
    + + + + + + + +

    + Class Method Summary + (collapse) +

    + +
      + +
    • + + + + (Object) notify_user(user) + + + + + + + + + + + + + +
      +

      the view for this email is textual and it should be extended to have a link +to the site in the email.

      +
      + +
    • + + +
    + + + + + +
    +

    Class Method Details

    + + +
    +

    + + + (Object) notify_user(user) + + + + + +

    +
    + +

    the view for this email is textual and it should be extended to have a link +to the site in the email. view: /app/views/user_mailer/notify_user.text.erb

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +12
    +13
    +14
    +15
    +
    +
    # File 'app/mailers/user_mailer.rb', line 12
    +
    +def self.notify_user(user)
    +  @user = user
    +  mail(to: @user.email, subject: 'Chemistry Geneology registration')
    +end
    +
    +
    + +
    + +
    + + + + + \ No newline at end of file diff --git a/backend/doc/UserSerializer.html b/backend/doc/UserSerializer.html index 337d64e..d7d68f1 100644 --- a/backend/doc/UserSerializer.html +++ b/backend/doc/UserSerializer.html @@ -114,9 +114,9 @@ diff --git a/backend/doc/Verifier.html b/backend/doc/Verifier.html index 94dc358..c3137a0 100644 --- a/backend/doc/Verifier.html +++ b/backend/doc/Verifier.html @@ -159,7 +159,9 @@

    -
    +
    +

    verifies an admin by their id.

    +
    @@ -252,7 +254,7 @@

    -

    yeah it does what you think.

    +

    verifies a user by their id.

    @@ -276,13 +278,23 @@

    -

    +
    +
    + +

    verifies an admin by their id

    + + +
    +
    +
    + + +
     
     
    -18
     19
     20
     21
    @@ -290,15 +302,20 @@ 

    23 24 25 -26

    +26 +27 +28 +29
    -
    # File 'app/lib/verifier.rb', line 18
    +      
    # File 'app/lib/verifier.rb', line 19
     
     def self.verify_admin(admin_id)
       @admin = Admin.find_by_id(admin_id)
       @admin.approved = true
    -  if @admin.save
    +  @user = User.find_by_id(@admin.user_id)
    +  @user.approved = true
    +  if @admin.save && @user.save
         return {'admin' => @admin}
       else
         return nil
    @@ -324,9 +341,6 @@ 

     
     
    -28
    -29
    -30
     31
     32
     33
    @@ -342,10 +356,13 @@ 

    43 44 45 -46

    +46 +47 +48 +49

    -
    # File 'app/lib/verifier.rb', line 28
    +      
    # File 'app/lib/verifier.rb', line 31
     
     def self.verify_mentorship(mentorship_id)
       @mentorship = Mentorship.includes(:institution)
    @@ -401,9 +418,6 @@ 

     
     
    -80
    -81
    -82
     83
     84
     85
    @@ -464,16 +478,29 @@ 

    140 141 142 -143

    +143 +144 +145 +146 +147 +148 +149 +150 +151

    -
    # File 'app/lib/verifier.rb', line 80
    +      
    # File 'app/lib/verifier.rb', line 83
     
     def self.verify_person(person_id)
    -  @person = Search.person_info(person_id)
    +  # false because we're using the search function to find unapproved person
    +  # information. False is handed to the :approved key in the where clause
    +  # for Search.person_info(id, approved)
    +  @person = Search.person_info(person_id)
     
       if @person["person"].approved == false
         @person["person"].approved = true
    +    #search/autocomplete is performed assuming all lower cases in name
    +    @person["person"].name = @person["person"].name.downcase
         @person["person"].save
       end
       if @person["person"].institution.approved == false
    @@ -553,9 +580,6 @@ 

     
     
    -48
    -49
    -50
     51
     52
     53
    @@ -578,10 +602,13 @@ 

    70 71 72 -73

    +73 +74 +75 +76

    -
    # File 'app/lib/verifier.rb', line 48
    +      
    # File 'app/lib/verifier.rb', line 51
     
     def self.verify_supervision(supervision_id)
       @supervision = Supervision.includes(degree: :institution)
    @@ -626,7 +653,7 @@ 

    -

    yeah it does what you think

    +

    verifies a user by their id

    @@ -674,9 +701,9 @@

    diff --git a/backend/doc/_index.html b/backend/doc/_index.html index 1852469..dd04865 100644 --- a/backend/doc/_index.html +++ b/backend/doc/_index.html @@ -95,12 +95,12 @@

    Namespace Listing A-Z

  • - AdminController + AdminSerializer
  • - AdminSerializer + AdminsController
  • @@ -424,6 +424,11 @@

    Namespace Listing A-Z

    +
  • + UserMailer + +
  • +
  • UserSerializer @@ -461,9 +466,9 @@

    Namespace Listing A-Z

    diff --git a/backend/doc/class_list.html b/backend/doc/class_list.html index f5ed8c2..353b5f7 100644 --- a/backend/doc/class_list.html +++ b/backend/doc/class_list.html @@ -50,7 +50,7 @@

    Class List

    diff --git a/backend/doc/file.README.html b/backend/doc/file.README.html index 869ba66..ce0abbd 100644 --- a/backend/doc/file.README.html +++ b/backend/doc/file.README.html @@ -87,9 +87,9 @@

    futher documentation

    diff --git a/backend/doc/index.html b/backend/doc/index.html index 869ba66..ce0abbd 100644 --- a/backend/doc/index.html +++ b/backend/doc/index.html @@ -87,9 +87,9 @@

    futher documentation

    diff --git a/backend/doc/method_list.html b/backend/doc/method_list.html index 63bb11d..6219b83 100644 --- a/backend/doc/method_list.html +++ b/backend/doc/method_list.html @@ -76,14 +76,14 @@

    Method List

  • - #as_json - Degree + #as_json + Person
  • - #as_json - Person + #as_json + Degree
  • @@ -94,14 +94,14 @@

    Method List

  • - #as_json - Institution + #as_json + Supervision
  • - #as_json - Supervision + #as_json + Institution
  • @@ -118,44 +118,44 @@

    Method List

  • - #create - Api::InstitutionsController + #create + AdminsController
  • - #create - Api::SupervisionsController + #create + Api::VerificationController
  • - #create - Api::VerificationController + #create + Api::InstitutionsController
  • - #create - Api::MentorshipsController + #create + Api::SupervisionsController
  • - #create - Api::AggregatedController + #create + Api::MentorshipsController
  • - #create - Api::DegreesController + #create + Api::AggregatedController
  • - #create - Api::AdminsController + #create + Api::DegreesController
  • @@ -166,59 +166,71 @@

    Method List

  • + #create + Api::AdminsController +
  • + + +
  • #current_user ApplicationController
  • -
  • +
  • decode AuthToken
  • -
  • +
  • degree FindId
  • -
  • +
  • delete_admin Deleter
  • -
  • +
  • delete_mentorship Deleter
  • -
  • +
  • delete_person Deleter
  • -
  • +
  • delete_supervision Deleter
  • -
  • +
  • delete_user Deleter
  • -
  • +
  • #destroy UserController
  • +
  • + #destroy + Api::VerificationController +
  • + +
  • #destroy Api::InstitutionsController @@ -232,29 +244,29 @@

    Method List

  • - #destroy - Api::VerificationController -
  • - - -
  • #destroy Api::MentorshipsController
  • -
  • +
  • #destroy Api::AggregatedController
  • -
  • +
  • #destroy Api::DegreesController
  • +
  • + #destroy + Api::PeopleController +
  • + +
  • #destroy Api::AdminsController @@ -262,8 +274,8 @@

    Method List

  • - #destroy - Api::PeopleController + #edit + Api::VerificationController
  • @@ -280,35 +292,23 @@

    Method List

  • - #edit - Api::VerificationController -
  • - - -
  • #edit Api::MentorshipsController
  • -
  • +
  • #edit Api::AggregatedController
  • -
  • +
  • #edit Api::DegreesController
  • -
  • - #edit - Api::AdminsController -
  • - -
  • #edit Api::PeopleController @@ -316,35 +316,47 @@

    Method List

  • + #edit + Api::AdminsController +
  • + + +
  • encode AuthToken
  • -
  • +
  • find_by_credentials User
  • -
  • +
  • find_institutions AutoComplete
  • -
  • +
  • find_names AutoComplete
  • -
  • +
  • #index UserController
  • +
  • + #index + AdminsController +
  • + +
  • #index SearchController @@ -358,8 +370,8 @@

    Method List

  • - #index - Api::NotificationController + #index + Api::VerificationController
  • @@ -370,14 +382,14 @@

    Method List

  • - #index - Api::SupervisionsController + #index + Api::NotificationController
  • - #index - Api::VerificationController + #index + Api::SupervisionsController
  • @@ -406,14 +418,14 @@

    Method List

  • - #index - Api::AdminsController + #index + Api::PeopleController
  • - #index - Api::PeopleController + #index + Api::AdminsController
  • @@ -448,20 +460,20 @@

    Method List

  • - #new - Api::InstitutionsController + #new + Api::VerificationController
  • - #new - Api::SupervisionsController + #new + Api::InstitutionsController
  • - #new - Api::VerificationController + #new + Api::SupervisionsController
  • @@ -484,14 +496,14 @@

    Method List

  • - #new - Api::AdminsController + #new + Api::PeopleController
  • - #new - Api::PeopleController + #new + Api::AdminsController
  • @@ -538,77 +550,89 @@

    Method List

  • + notify_user + UserMailer +
  • + + +
  • person Search
  • -
  • +
  • person FindId
  • -
  • +
  • person FindDetail
  • -
  • +
  • person_info Search
  • -
  • +
  • person_notifications Notifier
  • -
  • +
  • relations_by_id Search
  • -
  • +
  • relations_by_name Search
  • -
  • +
  • #routing ErrorsController
  • -
  • +
  • #serializer_for_mentorship Mentorship
  • -
  • +
  • #serializer_for_person Person
  • -
  • +
  • #serializer_for_supervision Supervision
  • -
  • +
  • #show UserController
  • +
  • + #show + Api::VerificationController +
  • + +
  • #show Api::InstitutionsController @@ -622,41 +646,29 @@

    Method List

  • - #show - Api::VerificationController -
  • - - -
  • #show Api::AuditTrailController
  • -
  • +
  • #show Api::MentorshipsController
  • -
  • +
  • #show Api::AggregatedController
  • -
  • +
  • #show Api::DegreesController
  • -
  • - #show - Api::AdminsController -
  • - -
  • #show Api::PeopleController @@ -664,35 +676,47 @@

    Method List

  • + #show + Api::AdminsController +
  • + + +
  • submit_handling Information
  • -
  • +
  • supervised Notifier
  • -
  • +
  • supervision_notifications Notifier
  • -
  • +
  • supervisors Notifier
  • -
  • +
  • #update UserController
  • +
  • + #update + Api::VerificationController +
  • + +
  • #update Api::InstitutionsController @@ -706,35 +730,23 @@

    Method List

  • - #update - Api::VerificationController -
  • - - -
  • #update Api::MentorshipsController
  • -
  • +
  • #update Api::AggregatedController
  • -
  • +
  • #update Api::DegreesController
  • -
  • - #update - Api::AdminsController -
  • - -
  • #update Api::PeopleController @@ -742,54 +754,60 @@

    Method List

  • + #update + Api::AdminsController +
  • + + +
  • update_handling Information
  • -
  • +
  • update_mentorship Mentorship
  • -
  • +
  • update_supervision Supervision
  • -
  • +
  • user_notifications Notifier
  • -
  • +
  • verify_admin Verifier
  • -
  • +
  • verify_mentorship Verifier
  • -
  • +
  • verify_person Verifier
  • -
  • +
  • verify_supervision Verifier
  • -
  • +
  • verify_user Verifier
  • diff --git a/backend/doc/top-level-namespace.html b/backend/doc/top-level-namespace.html index 61408d0..1f8dd03 100644 --- a/backend/doc/top-level-namespace.html +++ b/backend/doc/top-level-namespace.html @@ -87,7 +87,7 @@

    Defined Under Namespace

    - Classes: AccessDeniedError, Admin, AdminController, AdminSerializer, ApiController, ApplicationController, AuditTrail, AuthController, AuthToken, AuthenticationTimeoutError, AutoComplete, AutoCompleteController, Degree, Deleter, ErrorsController, FindDetail, FindId, Information, Institution, Mentor, Mentorship, NotAuthenticatedError, Notifier, Person, Postdoc, Search, SearchController, SearchSerializer, Supervision, Supervisor, User, UserController, UserSerializer, Verifier + Classes: AccessDeniedError, Admin, AdminSerializer, AdminsController, ApiController, ApplicationController, AuditTrail, AuthController, AuthToken, AuthenticationTimeoutError, AutoComplete, AutoCompleteController, Degree, Deleter, ErrorsController, FindDetail, FindId, Information, Institution, Mentor, Mentorship, NotAuthenticatedError, Notifier, Person, Postdoc, Search, SearchController, SearchSerializer, Supervision, Supervisor, User, UserController, UserMailer, UserSerializer, Verifier

    @@ -103,9 +103,9 @@

    Defined Under Namespace

    diff --git a/backend/spec/lib/information_spec.rb b/backend/spec/lib/information_spec.rb index 6b60be3..a201cc7 100644 --- a/backend/spec/lib/information_spec.rb +++ b/backend/spec/lib/information_spec.rb @@ -11,10 +11,10 @@ # actually this test will pass, because because an ActiveRecord will never # be equal to a number. http://guides.rubyonrails.org/active_record_querying.html - expect(@person.find_by_name("Ji Hwan Kim")).not_to eql(1) + expect(@person.find_by_name("Ji Hwan Kim")).to eql(nil) @person.new_person("Ji Hwan Kim", "Doctorate", "University of Alberta") # check if the person got created in db - expect(@person.find_by_name("Ji Hwan Kim")).not_to eql(0) + expect(@person.where(name: "Ji Hwan Kim")).not_to eql(nil) end end @@ -24,11 +24,11 @@ end it 'creates a new institution to db' do - # this test will fail since the new name doesn't exist in db yet - expect(@institution.find_by_name("University A")).not_to eql(1) + # this test will pass since the new name doesn't exist in db yet + expect(@institution.find_by_name("University A")).to eql(nil) @institution.new_institution("University A") # check if the person got created in db - expect(@institution.find_by_name("University A")).not_to eql(0) + expect(@institution.where(name: "University A")).not_to eql(nil) end end @@ -36,17 +36,18 @@ before do @person = Person @mentorship = Mentorship + @mentorshipLast = Mentorship.last end it 'creates a new mentorship to db' do - # this test will fail since there is only 10 ids in the person db - expect(@person.find_by_id(11)).not_to eql(1) - # this test will fail since there is only 6 ids in the mentorship db - expect(@mentorship.find_by_id(7)).not_to eql(1) - @mentorship.new_mentorship("Ji Hwan Kim", "Mentor A", "University of Alberta", "2014", "2016") + # this test will pass since there is no person with name Mentee A + expect(@person.find_by_name("Mentee A")).to eql(nil) + @mId = (@mentorshipLast.id) + 1 + expect(@mentorship.find_by_id(@mId)).to eql(nil) + @mentorship.new_mentorship("Mentee A", "Mentor A", "University of Alberta", "2014", "2016") # check if the person and mentorship got created in db - expect(@person.find_by_id(11)).not_to eql(0) - expect(@mentorship.find_by_id(7)).not_to eql(0) + expect(@person.where(name: "Mentee A")).not_to eql(nil) + expect(@mentorship.where(id: @mId)).not_to eql(nil) end end @@ -54,29 +55,209 @@ before do @person = Person @supervision = Supervision + @supervisionLast = Supervision.last end it 'creates a new supervision to db' do - # this test should fail as there are only 4 supervisions in db - expect(@person.find_by_id(11)).not_to eql(1) - expect(@supervision.find_by_id(5)).not_to eql(1) - @supervision.new_supervision("2016", "Doctorate", "University of Alberta", "Ji Hwan Kim", "Supervisor A") + # this test should pass as there is no person named Doctor A + expect(@person.find_by_name("Doctor A")).to eql(nil) + @sId = (@supervisionLast.id) + 1 + expect(@supervision.find_by_id(@sId)).to eql(nil) + @supervision.new_supervision("2016", "Doctorate", "University of Alberta", "Doctor A", "Supervisor A") # check if the supervision got created in db - expect(@supervision.find_by_id(5)) - expect(@person.find_by_id(11)).not_to eql(0) + expect(@supervision.where(id: @sId)).not_to eql(nil) + # check if the person got created in db + expect(@person.where(name: "Doctor A")).not_to eql(nil) end end describe Degree, '.new_degree' do before do @degree = Degree + @degreeLast = Degree.last end it 'creates a new degree to db' do # this test should fail as there are only 4 degrees in db - expect(@degree.find_by_id(5)).not_to eql(1) + @dId = (@degreeLast.id) + 1 + expect(@degree.find_by_id(@dId)).to eql(nil) @degree.new_degree("2016", "Doctorate", "University of Alberta") # check if the supervision got created in db - expect(@degree.find_by_id(5)).not_to eql(0) + expect(@degree.where(id: @dId)).not_to eql(nil) + end +end + +describe Person, '.edit_Person_Information' do + before do + @personFirst = Person.first + end + + it 'edits an existing person information' do + # this test will test for edtiting information + + # test for edit name + # I want to change the name to Ji Hwan Kim, first check if it is not equal to Ji Hwan Kim + # first check if the parameter is not nil + expect(@personFirst.name).to_not eql(nil) + + expect(@personFirst.name).to_not eql("Ji Hwan Kim") + @personFirst.update(name: "Ji Hwan Kim") + expect(@personFirst.name).to eql("Ji Hwan Kim") + + # test for edit position + # check if param is not nil + expect(@personFirst.position).not_to eql(nil) + + expect(@personFirst.position).to_not eql("Postition A") + @personFirst.update(position: "Position A") + expect(@personFirst.position).to eql("Position A") + end +end + +describe Degree, '.edit_Degree_Information' do + before do + @degreeFirst = Degree.first + end + + it 'edits an existing degree information' do + # this test will test for edtiting information + + # test for edit name + # I want to change the name to Ji Hwan Kim, first check if it is not equal to Ji Hwan Kim + # first check if the parameter is not nil + expect(@degreeFirst.degree_type).to_not eql(nil) + + expect(@degreeFirst.degree_type).to_not eql("Degree A") + @degreeFirst.update(degree_type: "Degree A") + expect(@degreeFirst.degree_type).to eql("Degree A") + + # test for edit degree year + # check if param is not nil + expect(@degreeFirst.year).not_to eql(nil) + + expect(@degreeFirst.year).to_not eql(2016) + @degreeFirst.update(year: 2016) + expect(@degreeFirst.year).to eql(2016) + end +end + +describe Institution, '.edit_Institution_Information' do + before do + @institutionFirst = Institution.first + end + + it 'edits an existing institution information' do + # test for editing institution information + # first check if param is not nil + expect(@institutionFirst.name).to_not eql(nil) + + expect(@institutionFirst.name).to_not eql("University A") + @institutionFirst.update(name: "University A") + expect(@institutionFirst.name).to eql("University A") + end +end + +describe Mentorship, '.edit_Mentorship_Information' do + before do + @mentorshipFirst = Mentorship.first + @person = Person + end + + it 'edits an existing mentorship information' do + # test for editing mentorship information + # first check if param is not nil + @mId = @mentorshipFirst.mentor_id + expect(@mId).to_not eql(nil) + + @mentor = @person.find_by_id(@mId) + + expect(@mentor.name).to_not eql("Mentor A") + @mentor.update(name: "Mentor A") + expect(@mentor.name).to eql("Mentor A") + end +end + +describe Supervision, '.edit_Supervision_Information' do + before do + @supervisionFirst = Supervision.first + @person = Person + end + + it 'edits an exsiting supervision information' do + # test for editing supervision information + # first check if param is not nil + @sId = @supervisionFirst.supervisor_id + expect(@sId).to_not eql(nil) + + @supervisor = @person.find_by_id(@sId) + + expect(@supervisor.name).to_not eql("Supervisor A") + @supervisor.update(name: "Supervisor A") + expect(@supervisor.name).to eql("Supervisor A") end end + +describe Person, '.check_Admin_Approval' do + before do + @personLast = Person.last + end + + it '.checks the admin approval' do + # test for checking admin approval + expect(@personLast.approved).to eql(true) + @personLast.update(approved: false) + expect(@personLast.approved).to eql(false) + end +end + +describe Institution, '.check_Admin_Approval' do + before do + @institutionLast = Institution.last + end + + it '.checks the admin approval' do + # test for checking admin approval + expect(@institutionLast.approved).to eql(false) + @institutionLast.update(approved: true) + expect(@institutionLast.approved).to eql(true) + end +end + +describe Mentorship, '.check_Admin_Approval' do + before do + @mentorshipLast = Mentorship.last + end + + it '.checks the admin approval' do + # test for checking admin approval + expect(@mentorshipLast.approved).to eql(false) + @mentorshipLast.update(approved: true) + expect(@mentorshipLast.approved).to eql(true) + end +end + +describe Supervision, '.check_Admin_Approval' do + before do + @supervisionLast = Supervision.last + end + + it '.checks the admin approval' do + # test for checking admin approval + expect(@supervisionLast.approved).to eql(false) + @supervisionLast.update(approved: true) + expect(@supervisionLast.approved).to eql(true) + end +end + +describe Degree, '.check_Admin_Approval' do + before do + @degreeLast = Degree.last + end + + it '.checks the admin approval' do + # test for checking admin approval + expect(@degreeLast.approved).to eql(false) + @degreeLast.update(approved: true) + expect(@degreeLast.approved).to eql(true) + end +end \ No newline at end of file diff --git a/doc/log/Individual Log/steven_myers.md b/doc/log/Individual Log/steven_myers.md index 2a8a082..1436d23 100644 --- a/doc/log/Individual Log/steven_myers.md +++ b/doc/log/Individual Log/steven_myers.md @@ -113,3 +113,12 @@ https://github.com/401ChemistryGenealogy/ChemistryGenealogy/wiki/Initial-Softwar * auto generated documentation * wrote various tests * updated UI + +--- + +###Sprint 5 + +* reworked UI for view/admin panels +* found bugs in search +* found bugs in autocomplete +* found bugs in verification diff --git a/doc/log/Individual Log/theresa_ngo.md b/doc/log/Individual Log/theresa_ngo.md index 39b3ef7..51a08ce 100644 --- a/doc/log/Individual Log/theresa_ngo.md +++ b/doc/log/Individual Log/theresa_ngo.md @@ -37,3 +37,29 @@ #####February 27, 2016 - March 4, 2016 * Worked on backend submit and edit information models + +--- + +###Sprint 4 + +#####March 5, 2016 - March 11, 2016 +* Made a class for formatting information to be sent to the frontend (not in use) + +#####March 12, 2016 - March 18, 2016 +* Made a serializer for sending edit information to the frontend (not currently in use) +* Submit completed +* Edit mostly complete, but with some bugs +* Documented submit and edit + +--- + +###Sprint 5 + +#####March 19, 2016 - March 25, 2016 +* Research on what could be causing the edit bugs + +#####March 26, 2016 - April 1, 2016 +* Submit updated to include new sections +* Edit updated to include new sections +* Edit completed +* Updated documentation for submit and edit diff --git a/doc/log/Meeting Log/weekly_log.textile b/doc/log/Meeting Log/weekly_log.textile index a99a5a5..d0d5ab7 100644 --- a/doc/log/Meeting Log/weekly_log.textile +++ b/doc/log/Meeting Log/weekly_log.textile @@ -63,3 +63,27 @@ |Participants|Cole, Connor, Daniel, Theresa| |Minutes|2 hours| |Agenda|Meeting with the professor and TA
  • Update on project planning and progress
  • | + +|Date|March 4, 2016| +|Formality|Formal| +|Participants|Cole, Daniel, Ji Hwan, Steven, Theresa| +|Minutes|2 hours| +|Agenda|Meeting with the professor and TA
  • Update on project progress
  • Made deadlines for the remaining use cases
  • | + +|Date|March 11, 2016| +|Formality|Formal| +|Participants|Cole, Connor, Daniel, Ji Hwan, Steven, Theresa| +|Minutes|2 hours| +|Agenda|Meeting with the TA
  • Update on project progress
  • Received feedback on part of the demo
  • Set a meeting time for the entire group to meet with the TA and work on the project
  • | + +|Date|March 14, 2016| +|Formality|Formal| +|Participants|Cole, Connor, Daniel, Ji Hwan, Steven, Theresa| +|Minutes|5 hours| +|Agenda|Meeting with the TA
  • Mandatory meeting to work on the project
  • | + +|Date|March 18, 2016| +|Formality|Formal| +|Participants|Cole, Connor, Daniel, Steven, Theresa| +|Minutes|2 hours| +|Agenda|Meeting with the TA
  • Update on project progress
  • Received feedback on the working demo
  • | diff --git a/frontend/web/app/controllers/editController.js b/frontend/web/app/controllers/editController.js index 0fbb5c0..b8077fa 100644 --- a/frontend/web/app/controllers/editController.js +++ b/frontend/web/app/controllers/editController.js @@ -827,7 +827,6 @@ angular.module('chemGeno') return; }else{ $scope.pdInstitutionWarning = false; - alert("alert value: " + pdInstitution); console.log(pdInstitution); } @@ -1006,13 +1005,13 @@ angular.module('chemGeno') }else{ $scope.diTypeWarning = false; } - var newDegreeInfoInstance = new DegreeInfoInstance(diYear, diSupervisor, diInstitution, diType, idId, supervisionId); + var newDegreeInfoInstance = new DegreeInfoInstance(diYear, diSupervisor, diInstitution, diType, diId, supervisionId); $scope.degreeInformation.push(newDegreeInfoInstance); console.log("AddPostDocInstance Called on" + $scope.degreeInfoInformation); //Refresh the view of the scope. - $scope.$apply(); + //$scope.$apply(); }; /** diff --git a/frontend/web/app/controllers/submitController.js b/frontend/web/app/controllers/submitController.js index 20f378b..379e104 100644 --- a/frontend/web/app/controllers/submitController.js +++ b/frontend/web/app/controllers/submitController.js @@ -656,7 +656,7 @@ angular.module('chemGeno') var newDegreeInfoInstance = new DegreeInfoInstance(diYear, diSupervisor, diInstitution, diType); $scope.degreeInformation.push(newDegreeInfoInstance); - console.log("AddPostDocInstance Called on" + $scope.degreeInfoInformation); + console.log("AddDegreeInfoInstance Called on" + $scope.degreeInformation); diInstitution = null; diYear = null; diff --git a/frontend/web/app/services/editService.js b/frontend/web/app/services/editService.js index e38dda5..791f651 100644 --- a/frontend/web/app/services/editService.js +++ b/frontend/web/app/services/editService.js @@ -60,11 +60,12 @@ angular.module('chemGeno') */ var sendEditedData = function(modifications, idObj){ var d = $q.defer(); - console.log("modification"+modifications); + console.log(modifications.name); + console.log(idObj) var token = loginService.getAuthToken(); //Obtain the authentication token from the login service. return $http({ headers: { - "Content-Type": "application/json'", + "Content-Type": "application/json;charset=utf-8'", "Authorization": token }, method: 'PUT', @@ -77,8 +78,8 @@ angular.module('chemGeno') institution: modifications.currentInstitutionName, degree: modifications.degreeInformation, postdoc: modifications.postDocInformation, - superdoc:submitFileObject.superDocInformation, - superdeg: submitFileObject.superDegInformation + superdoc: modifications.superDocInformation, + superdeg: modifications.superDegInformation } }).success(function(resp) { d.resolve(resp); diff --git a/frontend/web/app/services/submitService.js b/frontend/web/app/services/submitService.js index 5bfef9e..e3c83c4 100644 --- a/frontend/web/app/services/submitService.js +++ b/frontend/web/app/services/submitService.js @@ -30,9 +30,9 @@ angular.module('chemGeno') position: submitFileObject.currentPositionTitle, institution: submitFileObject.currentInstitutionName, degree: submitFileObject.degreeInformation, - postdoc:submitFileObject.postDocInformation, - superdoc:submitFileObject.superDocInformation, - superdeg: submitFileObject.superDegInformation + postdoc: submitFileObject.postDocInformation, + superdeg: submitFileObject.superDegInformation, + superdoc: submitFileObject.superDocInformation } }).success(function(resp) { d.resolve(resp); diff --git a/frontend/web/app/views/submit.html b/frontend/web/app/views/submit.html index 4fc4463..a6fd28a 100644 --- a/frontend/web/app/views/submit.html +++ b/frontend/web/app/views/submit.html @@ -240,11 +240,11 @@

    Postdoctoral Appointments Section

    - Clear Fields + @@ -290,11 +290,11 @@

    Postdoctoral Appointments Section

    - Edit + @@ -413,11 +413,11 @@

    Degree Information Section

    - Clear Fields + @@ -460,11 +460,11 @@

    Degree Information Section

    - Edit + @@ -561,11 +561,11 @@

    Postdocs this Person SUPERVISED

    - Clear Fields + @@ -609,11 +609,11 @@

    Postdocs this Person SUPERVISED

    - Edit + @@ -743,11 +743,11 @@

    People who this person supervised their DEGREES

    - Clear Fields +