Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
LocoDelAssembly committed Sep 13, 2022
2 parents 568df5a + 640ff38 commit c499077
Show file tree
Hide file tree
Showing 26 changed files with 134 additions and 69 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv

\-

## [0.29.3] - 2022-09-13

### Fixed
- View image matrix button doesn't work in Interactive key task
- Missing collectors parameters in Filter collecting events.
- Pagination on Image Matrix task
- Project Preferences task causing internal server errors
- Boolean params not handled correctly on specific conditions in some filters

## [0.29.2] - 2022-09-08
### Added
- Administration level project classification visualization [#3092]
Expand Down Expand Up @@ -2893,7 +2902,8 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv

[#1532]: https://github.com/SpeciesFileGroup/taxonworks/issues/1532

[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.29.2...development
[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.29.3...development
[0.29.3]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.29.2...v0.29.3
[0.29.2]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.29.1...v0.29.2
[0.29.1]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.29.0...v0.29.1
[0.29.0]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.28.1...v0.29.0
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.development
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG BUNDLER_WORKERS=1
# Install Firefox (for headless feature tests)
RUN apt-get update && \
apt-get install -y locales \
libgtk-3-0 libgtk-3-dev libdbus-glib-1-2 libxt6 && \
libgtk-3-0 libgtk-3-dev libdbus-glib-1-2 libxt6 libasound2 && \
curl -sL 'https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64' | \
tar -xjf - -C /usr/bin && \
/usr/bin/firefox/firefox --version && \
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/collecting_events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ def filter_params
:end_date, # used in date range
:geo_json,
:geographic_area_id,
:georeferences,
:geographic_area,
:identifier,
:identifier_end,
:identifier_exact,
Expand Down Expand Up @@ -350,7 +352,9 @@ def api_params
:depictions,
:end_date, # used in date range
:geo_json,
:georeferences,
:geographic_area_id,
:geographic_area,
:identifier,
:identifier_end,
:identifier_exact,
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/vue/routes/endpoints/CollectingEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const CollectingEvent = {

clone: (id, params) => AjaxCall('post', `/${controller}/${id}/clone`, params),

filter: params => AjaxCall('post', `/${controller}/filter`, params),
filter: params => AjaxCall('post', `/${controller}/filter.json`, params),

navigation: (id) => AjaxCall('get', `/${controller}/${id}/navigation`),

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/vue/routes/endpoints/CollectionObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const CollectionObject = {

dwcIndex: (params) => AjaxCall('get', `/${controller}/dwc_index`, { params }),

filter: (params) => AjaxCall('post', `/${controller}/filter`, params),
filter: (params) => AjaxCall('post', `/${controller}/filter.json`, params),

metadataBadge: (id) => AjaxCall('get', `/${controller}/${id}/metadata_badge`),

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/vue/routes/endpoints/Extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ export const Extract = {
...baseCRUD(controller, permitParams),
...annotations(controller),

filter: params => AjaxCall('post', `/${controller}/filter`, params)
filter: params => AjaxCall('post', `/${controller}/filter.json`, params)
}
2 changes: 1 addition & 1 deletion app/javascript/vue/routes/endpoints/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ export const Image = {
...baseCRUD(controller, permitParams),
...annotations(controller),

filter: params => AjaxCall('post', `/${controller}/filter`, params)
filter: params => AjaxCall('post', `/${controller}/filter.json`, params)
}
2 changes: 1 addition & 1 deletion app/javascript/vue/routes/endpoints/People.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const People = {

roles: id => AjaxCall('get', `/${controller}/${id}/roles.json`),

filter: params => AjaxCall('post', `/${controller}/filter`, params),
filter: params => AjaxCall('post', `/${controller}/filter.json`, params),

merge: (id, params) => AjaxCall('post', `/people/${id}/merge`, params)
}
2 changes: 1 addition & 1 deletion app/javascript/vue/routes/endpoints/Source.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const Source = {

clone: (id, params) => AjaxCall('post', `/${model}/${id}/clone`, params),

filter: params => AjaxCall('post', `/${model}/filter`, params),
filter: params => AjaxCall('post', `/${model}/filter.json`, params),

parse: params => AjaxCall('get', `/${model}/parse.json`, { params })
}
2 changes: 1 addition & 1 deletion app/javascript/vue/routes/endpoints/TaxonName.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const permitParams = {
export const TaxonName = {
...baseCRUD(model, permitParams),

filter: params => AjaxCall('post', `/${model}/filter`, params),
filter: params => AjaxCall('post', `/${model}/filter.json`, params),

ranks: () => AjaxCall('get', `/${model}/ranks`),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export default {
if (this.emptyParams) return
const params = this.filterEmptyParams({
...checkMatchIdentifiersParams(this.params.matchIdentifiers),
...this.params.collectors,
...this.params.keywords,
...this.params.dataAttributes,
...this.params.identifier,
Expand All @@ -179,6 +180,7 @@ export default {
...this.params.byRecordsWith,
...this.params.user,
...this.params.settings,
...this.params.types,
...this.flatObject(this.params.collectingEvents, 'fields')
})
Expand Down
62 changes: 37 additions & 25 deletions app/javascript/vue/tasks/interactive_keys/components/RowFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<button
type="button"
class="button normal-input button-default margin-small-bottom"
@click="setModelView(true)">
@click="setModelView(true)"
>
Select
</button>
<modal-component
Expand All @@ -13,7 +14,8 @@
width: '500px',
overflow: 'scroll',
maxHeight: '80vh'
}">
}"
>
<template #header>
<h3>Row filter</h3>
</template>
Expand All @@ -22,37 +24,41 @@
<button
v-if="allSelected"
type="button"
class="button normal-input button-default margin-small-bottom"
@click="unselectAll">
class="button normal-input button-default margin-small-bottom margin-small-right"
@click="unselectAll"
>
Unselect all
</button>
<button
v-else
type="button"
class="button normal-input button-default margin-small-bottom"
@click="selectAll">
class="button normal-input button-default margin-small-bottom margin-small-right"
@click="selectAll"
>
Select all
</button>
<button
type="button"
class="button normal-input button-default"
@click="closeAndApply">
class="button normal-input button-default margin-small-right"
@click="closeAndApply"
>
Apply filter
</button>
<button-image-matrix
:otu-ids="otuIds"/>
<button-image-matrix :otu-ids="otuIds" />
</div>
<ul class="no_bullets">
<li
v-for="item in remaining"
:key="item.object.id"
class="margin-small-bottom middle">
class="margin-small-bottom middle"
>
<label>
<input
v-model="selectedRows"
:value="item.object.id"
type="checkbox">
<span v-html="displayLabel(item.object)"/>
type="checkbox"
>
<span v-html="displayLabel(item.object)" />
</label>
</li>
</ul>
Expand All @@ -62,25 +68,27 @@
<button
v-if="allSelected"
type="button"
class="button normal-input button-default margin-small-bottom"
@click="unselectAll">
class="button normal-input button-default margin-small-bottom margin-small-right"
@click="unselectAll"
>
Unselect all
</button>
<button
v-else
type="button"
class="button normal-input button-default margin-small-bottom"
@click="selectAll">
class="button normal-input button-default margin-small-bottom margin-small-right"
@click="selectAll"
>
Select all
</button>
<button
type="button"
class="button normal-input button-default"
@click="closeAndApply">
class="button normal-input button-default margin-small-right"
@click="closeAndApply"
>
Apply filter
</button>
<button-image-matrix
:otu-ids="otuIds"/>
<button-image-matrix :otu-ids="otuIds" />
</div>
</template>
</modal-component>
Expand Down Expand Up @@ -125,11 +133,15 @@ export default {
},
otuIds () {
const objects = this.remaining
.map(item => item.object)
.filter(item => this.selectedRows.includes(item.id))
const ids = []
return objects.map(item => item.otu_id).filter(id => id)
this.remaining.forEach(({ object }) => {
if (this.selectedRows.includes(object.id)) {
ids.push(object.observation_object_id)
}
})
return ids
},
allSelected () {
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/vue/tasks/observation_matrices/image/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ export default {
loadPage ({ page }) {
this.$store.dispatch(ActionNames.LoadObservationMatrix, {
observation_matrix_id: this.matrixId,
observation_matrix_id: this.matrixId || 0,
page,
otu_filter: this.otuFilter,
per: this.per
})
setParam(RouteNames.ImageMatrix, 'observation_matrix_id', this.matrixId)
Expand Down
1 change: 0 additions & 1 deletion app/models/source/verbatim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def date
def generate_bibtex
return false if verbatim.blank?
result = TaxonWorks::Vendor::Serrano.new_from_citation(citation: verbatim)
byebug
if result.type == 'Source::Bibtex'
result
else
Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1 +1 @@
json.partial '/projects/attributes', project: @project
json.partial! '/projects/attributes', project: @project
38 changes: 37 additions & 1 deletion lib/queries/collecting_event/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class Filter
# whether the CollectingEvent has associated CollectionObjects
attr_accessor :collection_objects


# @return Array
# @param collection_object_id [Array, Integer, String]
# all collecting events matching collection objects
Expand All @@ -107,6 +106,18 @@ class Filter
# nil - not applied
attr_accessor :depictions

# @return [True, False, nil]
# true - georeferences
# false - not georeferenced
# nil - not applied
attr_accessor :georeferences

# @return [True, False, nil]
# true - has geographic_area present
# false - without geographic_area
# nil - not applied
attr_accessor :geographic_area

def initialize(params)
# @spatial_geographic_area_ids = params[:spatial_geographic_areas].blank? ? [] : params[:spatial_geographic_area_ids]

Expand All @@ -116,6 +127,8 @@ def initialize(params)
@collection_objects = boolean_param(params, :collection_objects )
@collection_object_id = params[:collection_object_id]
@depictions = boolean_param(params, :depictions)
@georeferences = boolean_param(params, :georeferences)
@geographic_area = boolean_param(params, :geographic_area)
@geo_json = params[:geo_json]
@geographic_area_id = params[:geographic_area_id]
@in_labels = params[:in_labels]
Expand Down Expand Up @@ -183,6 +196,15 @@ def attribute_clauses
c
end

def geographic_area_facet
return nil if geographic_area.nil?
if geographic_area
::CollectingEvent.where.not(geographic_area_id: null).distinct
else
::CollectingEvent.where(geographic_area_id: null).distinct
end
end

def depictions_facet
return nil if depictions.nil?

Expand All @@ -195,6 +217,18 @@ def depictions_facet
end
end

def georeferences_facet
return nil if georeferences.nil?

if georeferences
::CollectingEvent.joins(:georeferences).distinct
else
::CollectingEvent.left_outer_joins(:georeferences)
.where(georeferences: {id: nil})
.distinct
end
end

# @return Scope
def collection_objects_facet
return nil if collection_objects.nil?
Expand Down Expand Up @@ -336,7 +370,9 @@ def base_merge_clauses
data_attribute_predicate_facet,
data_attribute_value_facet,
data_attributes_facet,
geographic_area_facet,
depictions_facet,
georeferences_facet,
geo_json_facet,
identifier_between_facet,
identifier_facet, # See Queries::Concerns::Identifiers
Expand Down
2 changes: 1 addition & 1 deletion lib/queries/collection_object/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class Filter < Queries::Query

# @param [Hash] args are permitted params
def initialize(params)
params.reject!{ |_k, v| v.blank? } # dump all entries with empty values
params.reject!{ |_k, v| v.nil? || (v == '') } # dump all entries with empty values

# Only CollectingEvent fields are permitted now.
# (Perhaps) TODO: allow concern attributes nested inside as well, e.g. show me all COs with this Tag on CE.
Expand Down
2 changes: 1 addition & 1 deletion lib/queries/concerns/protocols.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def set_protocols_params(params)
@protocol_id_and = params[:protocol_id_and].blank? ? [] : params[:protocol_id_and]
@protocol_id_or = params[:protocol_id_or].blank? ? [] : params[:protocol_id_or]

@protocols = (params[:protocols]&.downcase == 'true' ? true : false) if !params[:protocols].nil?
@protocols = (params[:protocols]&.to_s&.downcase == 'true' ? true : false) if !params[:protocols].nil?
end

def protocol_id_and
Expand Down
2 changes: 1 addition & 1 deletion lib/queries/concerns/tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def set_tags_params(params)
@keyword_id_and = params[:keyword_id_and].blank? ? [] : params[:keyword_id_and]
@keyword_id_or = params[:keyword_id_or].blank? ? [] : params[:keyword_id_or]

@tags = (params[:tags]&.downcase == 'true' ? true : false) if !params[:tags].nil?
@tags = (params[:tags]&.to_s&.downcase == 'true' ? true : false) if !params[:tags].nil?
end

def keyword_id_and
Expand Down
Loading

0 comments on commit c499077

Please sign in to comment.