Skip to content

Commit

Permalink
Updated biodiversity custom gem
Browse files Browse the repository at this point in the history
  • Loading branch information
LocoDelAssembly committed Sep 9, 2020
2 parents 4b09ac6 + 04af0ce commit 918e0d7
Show file tree
Hide file tree
Showing 33 changed files with 249 additions and 214 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -28,7 +28,7 @@ jobs:
bundler_args: --without development production
addons:
postgresql: "10"
firefox: "79.0"
firefox: "latest"
apt:
packages:
- imagemagick
Expand Down
31 changes: 29 additions & 2 deletions CHANGELOG.md
Expand Up @@ -7,7 +7,34 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv

## [unreleased]

\-
### Added
- Added `rake tw:maintenance:otus:missplaced_references` [#1439]
- Spinner for when converting verbatim to bibtex [#1710]

### Changed
- Methods that write to cached should not fire callbacks, potential for [#1701]
- Using custom geckodriver-helper for Firefox 80 support

## Fixed
- Serial multiple updates did not update bibtex author field [#1709]
- Fix (likely) for pinboard items failing to remove [#1690]
- Better response for failed collecting event cloning [#1705]
- Cleaned up deprecated biological associations graph autcomplete [#1707]
- Colliding `namespace` method for identifiers breaks identifiers list [#1702]
- Graceful failed serial destroy response [#1703]
- Restored Show -> edit link [#1699]


[#1439]: https://github.com/SpeciesFileGroup/taxonworks/issues/1439
[#1709]: https://github.com/SpeciesFileGroup/taxonworks/issues/1709
[#1690]: https://github.com/SpeciesFileGroup/taxonworks/issues/1690
[#1701]: https://github.com/SpeciesFileGroup/taxonworks/issues/1701
[#1705]: https://github.com/SpeciesFileGroup/taxonworks/issues/1705
[#1707]: https://github.com/SpeciesFileGroup/taxonworks/issues/1707
[#1702]: https://github.com/SpeciesFileGroup/taxonworks/issues/1702
[#1703]: https://github.com/SpeciesFileGroup/taxonworks/issues/1703
[#1699]: https://github.com/SpeciesFileGroup/taxonworks/issues/1699
[#1710]: https://github.com/SpeciesFileGroup/taxonworks/issues/1710

## [0.12.17] - 2020-02-02

Expand All @@ -30,7 +57,7 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv
- Removed limit of download bibtex on filter source [#1683]
- Disable/enable destroy button from metadata on radial navigator [#1696]

#### Fixed
### Fixed
- Non admins not able to destroy shared data [#1098]
- Pending confirmation: Include original combinations in CoLDP [#1204]
- Pending confirmation: Include forma/variety properly in CoLDP [#1203]
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -123,7 +123,7 @@ group :test, :development do
gem 'byebug', '~> 11.1', {}.merge(ENV['RM_INFO'] ? {require: false} : {})
gem 'factory_bot_rails', '~> 5.1', '>= 5.1.1'
gem 'selenium-webdriver', '~> 3.141'
gem 'geckodriver-helper', '~> 0.24.0'
gem 'geckodriver-helper', github: 'LocoDelAssembly/geckodriver-helper'
gem 'prawn', '~> 2.2.2'
end

Expand Down
13 changes: 9 additions & 4 deletions Gemfile.lock
Expand Up @@ -9,11 +9,18 @@ GIT

GIT
remote: https://github.com/LocoDelAssembly/biodiversity.git
revision: 555d1706f3603f4945b14009e2e0f6f3b57d5c6c
revision: 77406b3cf9b40cc08aacb2d5aeecf5997f19abde
branch: ipc-mode
specs:
biodiversity (4.1.0)

GIT
remote: https://github.com/LocoDelAssembly/geckodriver-helper.git
revision: 8cb32dde4b152250ad053aab7432b151d11dddf9
specs:
geckodriver-helper (0.27.0)
archive-zip (~> 0.7)

GIT
remote: https://github.com/james2m/seedbank
revision: 58d19b0c5c2afd139b3d395f2a516dd399eef57b
Expand Down Expand Up @@ -182,8 +189,6 @@ GEM
ffi-geos (2.1.0)
ffi (>= 1.0.0)
formatador (0.2.5)
geckodriver-helper (0.24.0)
archive-zip (~> 0.7)
globalid (0.4.2)
activesupport (>= 4.2.0)
gnfinder (0.11.0)
Expand Down Expand Up @@ -589,7 +594,7 @@ DEPENDENCIES
factory_bot_rails (~> 5.1, >= 5.1.1)
faker (~> 2.10)
ffi-geos (~> 2.1.0)
geckodriver-helper (~> 0.24.0)
geckodriver-helper!
gnfinder (~> 0.11.0)
google-protobuf (~> 3.12.0.rc.1)
gpx (~> 1.0.0)
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/biological_associations_controller.rb
Expand Up @@ -20,7 +20,7 @@ def index
}
end
end

# GET /biological_associations/1
# GET /biological_associations/1.json
def show
Expand Down Expand Up @@ -88,13 +88,13 @@ def search
end

private

def filter_params
params.permit(:subject_global_id, :object_global_id, :any_global_id, :biological_relationship_id)

# Shallow resource hack
if !params[:collection_object_id].blank? && c = CollectionObject.where(project_id: sessions_current_project_id).find(params[:collection_object_id])
params[:any_global_id] = c.to_global_id.to_s
params[:any_global_id] = c.to_global_id.to_s
end
params
end
Expand Down
17 changes: 1 addition & 16 deletions app/controllers/biological_associations_graphs_controller.rb
Expand Up @@ -76,22 +76,7 @@ def search
redirect_to biological_association_graph_path(params[:id])
end
end

def autocomplete
@biological_associations_graphs = BiologicalAssociationsGraph.find_for_autocomplete(params.merge(project_id: sessions_current_project_id))
data = @biological_associations_graphs.collect do |t|
{id: t.id,
label: ApplicationController.helpers.biological_associations_graph_tag(t),
response_values: {
params[:method] => t.id
},
label_html: ApplicationController.helpers.biological_associations_graph_autocomplete_selected_tag(t)
}
end

render json: data
end


private

def set_biological_associations_graph
Expand Down
11 changes: 8 additions & 3 deletions app/controllers/collecting_events_controller.rb
Expand Up @@ -50,9 +50,14 @@ def create
# POST /collecting_events/1/clone.json
def clone
@collecting_event = @collecting_event.clone
respond_to do |format|
format.html { redirect_to edit_collecting_event_path(@collecting_event), notice: 'Clone successful, on new record.' }
format.json { render :show }
if @collecting_event.persisted?
respond_to do |format|
format.html { redirect_to edit_collecting_event_path(@collecting_event), notice: 'Clone successful, on new record.' }
format.json { render :show }
end
else
format.html { redirect_to edit_collecting_event_path(@collecting_event), notice: 'Failed to clone the collecting event..' }
format.json {render json: @collecting_event.errors, status: :unprocessable_entity}
end
end

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/hub_controller.rb
Expand Up @@ -22,6 +22,7 @@ def order_tabs
end

def update_tab_order
# TODO: update_column likely
@sessions_current_user.update_attribute(:hub_tab_order, params[:order])
head :ok
end
Expand All @@ -32,6 +33,7 @@ def handle_bad_tab_order
# This is preventative only, it should never happen in real data, and may only occur when
# we reset tab performance.
if @sessions_current_user.hub_tab_order.empty?
# TODO: update_column likely
@sessions_current_user.update_attribute(:hub_tab_order, DEFAULT_HUB_TAB_ORDER)
end
true
Expand Down
32 changes: 21 additions & 11 deletions app/controllers/serials_controller.rb
Expand Up @@ -20,14 +20,6 @@ def index
end
end

def filter_params
params.permit(
:name, :id,
data_attributes_attributes: [ :id, :_destroy, :controlled_vocabulary_term_id, :type, :attribute_subject_id, :attribute_subject_type, :value ]
)
end


def list
@serials = Serial.order(:id).page(params[:page])
end
Expand Down Expand Up @@ -80,10 +72,15 @@ def update
# DELETE /serials/1
# DELETE /serials/1.json
def destroy
@serial.destroy!
@serial.destroy
respond_to do |format|
format.html { redirect_to serials_url }
format.json { head :no_content }
if @serial.destroyed?
format.html { redirect_to serials_url }
format.json { head :no_content }
else
format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Serial was not destroyed, ' + @serial.errors.full_messages.join('; '))}
format.json {render json: @serial.errors, status: :unprocessable_entity}
end
end
end

Expand Down Expand Up @@ -120,6 +117,19 @@ def download

private

def filter_params
params.permit(
:name, :id,
data_attributes_attributes: [
:id,
:_destroy,
:controlled_vocabulary_term_id,
:type,
:attribute_subject_id,
:attribute_subject_type,
:value ])
end

def set_serial
@serial = Serial.find(params[:id])
@recent_object = @serial
Expand Down
4 changes: 0 additions & 4 deletions app/helpers/biological_associations_graphs_helper.rb
Expand Up @@ -10,8 +10,4 @@ def biological_associations_graph_link(biological_associations_graph)
link_to(biological_associations_graph_tag(biological_associations_graph).html_safe, biological_associations_graph)
end

def biological_associations_graphs_search_form
render('/biological_associations_graphs/quick_search_form')
end

end
8 changes: 0 additions & 8 deletions app/helpers/namespaces_helper.rb
Expand Up @@ -33,14 +33,6 @@ def namespaces_search_form
render('/namespaces/quick_search_form')
end

def namespace_from_identifier_tag(identifier)
if identifier.respond_to?(:namespace)
namespace_tag(identifier.namespace)
else
nil
end
end

def namespace_select_tag(namespace_element)
select_tag(namespace_element,
options_for_select(Namespace.pluck(:short_name).uniq),
Expand Down
6 changes: 5 additions & 1 deletion app/helpers/workbench/navigation_helper.rb
@@ -1,6 +1,10 @@
# Methods for 1) generating paths; or 2) generating links.
module Workbench::NavigationHelper
NO_NEW_FORMS = %w{Confidence Attribution ObservationMatrixRow ObservationMatrixColumn Note Tag Citation Identifier DataAttribute AlternateValue GeographicArea ContainerItem ProtocolRelationship Download}.freeze

NO_NEW_FORMS = %w{Confidence Attribution ObservationMatrixRow ObservationMatrixColumn Note Tag
Citation Identifier DataAttribute AlternateValue
GeographicArea ContainerItem ProtocolRelationship Download}.freeze

NOT_DATA_PATHS = %w{/project /administration /user}.freeze

# Slideout panels
Expand Down
9 changes: 8 additions & 1 deletion app/javascript/vue/tasks/sources/new_source/app.vue
Expand Up @@ -110,13 +110,19 @@
<bibtex-button
v-if="showBibtex"
@close="showBibtex = false"/>
<spinner-component
v-if="settings.isConverting"
:full-screen="true"
:logo-size="{ width: '100px', height: '100px'}"
legend="Converting verbatim to BiBTeX..."/>
</div>
</template>

<script>
import SourceType from './components/sourceType'
import RecentComponent from './components/recent'
import SpinnerComponent from 'components/spinner'
import CrossRef from './components/crossRef'
import BibtexButton from './components/bibtex'
Expand Down Expand Up @@ -153,7 +159,8 @@ export default {
BibtexButton,
AddSource,
NavBar,
RecentComponent
RecentComponent,
SpinnerComponent
},
computed: {
section () {
Expand Down
Expand Up @@ -4,7 +4,7 @@ import { UpdateSource, LoadSoftValidation } from '../../request/resources'
import setParam from 'helpers/setParam'

export default ({ state, commit }) => {
state.settings.saving = true
state.settings.isConverting = true
if (state.source.id) {
UpdateSource({ id: state.source.id, convert_to_bibtex: true }).then(response => {
if (response.body.type === 'Source::Bibtex') {
Expand All @@ -13,8 +13,9 @@ export default ({ state, commit }) => {
} else {
TW.workbench.alert.create('Source needs to be converted manually', 'error')
}
state.settings.isConverting = false
}, () => {
state.settings.saving = false
state.settings.isConverting = false
})
}

Expand Down
1 change: 1 addition & 0 deletions app/javascript/vue/tasks/sources/new_source/store/store.js
Expand Up @@ -13,6 +13,7 @@ function makeInitialState () {
return {
settings: {
saving: false,
isConverting: false,
loading: false,
lastSave: 0,
lastEdit: 0,
Expand Down
4 changes: 0 additions & 4 deletions app/models/biological_associations_graph.rb
Expand Up @@ -16,8 +16,4 @@ class BiologicalAssociationsGraph < ApplicationRecord
has_many :biological_associations_biological_associations_graphs, inverse_of: :biological_associations_graph
has_many :biological_associations, through: :biological_associations_biological_associations_graphs

def self.find_for_autocomplete(params)
Queries::BiologicalAssociationsGraphAutocompleteQuery.new(params[:term]).all.where(project_id: params[:project_id])
end

end
6 changes: 1 addition & 5 deletions app/models/citation.rb
Expand Up @@ -119,11 +119,7 @@ def reject_topic(attributed)

def update_related_cached_values
if citation_object_type == 'TaxonName'
t = citation_object
if t.id
taxon = TaxonName.find(t.id)
taxon.update_attribute(:cached_author_year, citation_object.get_author_and_year)
end
citation_object.update_column(:cached_author_year, citation_object.get_author_and_year) if citation_object.persisted?
end
true
end
Expand Down
9 changes: 3 additions & 6 deletions app/models/collecting_event.rb
Expand Up @@ -1075,7 +1075,8 @@ def cached_level0_name
cache_geographic_names[:state]
end

# @return [CollectingEvent instance]
# @return [CollectingEvent]
# the instance may not be valid!
def clone
a = dup
a.verbatim_label = [verbatim_label, "[CLONED FROM #{id}", "at #{Time.now}]"].compact.join(' ')
Expand All @@ -1092,11 +1093,7 @@ def clone
end
end

begin
a.save!
rescue ActiveRecord::RecordInvalid
return false
end
a.save
a
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/shared/is_data.rb
Expand Up @@ -122,7 +122,7 @@ def is_editable?(user)
end

def is_in_users_projects?(user)
user.projects.where(id: created_by_id).any?
user.projects.pluck(:id).include?(project_id)
end

# @return [Boolean]
Expand Down

0 comments on commit 918e0d7

Please sign in to comment.