Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
LocoDelAssembly committed Apr 26, 2024
2 parents a06cb32 + d0db905 commit 9f5ae90
Show file tree
Hide file tree
Showing 38 changed files with 801 additions and 459 deletions.
28 changes: 26 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,34 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv

\-

## [0.40.5] - 2024-04-25

### Added

- `/api/v1/taxon_name_relationships.csv` endpoint

### Changed

- Dwca `otu_name` only includes Otu#name, never anything else.
- `api/v1/otus/autocomplete` now more acurately returns the label of the matching term, i.e. Combinations are supported in rendering [https://github.com/SpeciesFileGroup/taxonpages/issues/193]
- Update Ruby gems

### Fixed

- Quick forms: Lock buttons don't work on Biological associations.
- Week in review task [#3926]
- Missing Image metadata breaks radial
- Basic endemism task had a broken link out
- Prevent raise on bad polygon (LinearRing) Georeferences


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

## [0.40.4] - 2024-04-21

### Added

- User estimated time tracking at the per-project level
- User estimated time tracking at the per-project level
- Orphaned DwcOccurrence and DelayedJob job metadata to admin Health report

### Changed
Expand Down Expand Up @@ -4527,7 +4550,8 @@ _Special thanks to Tom Klein for his amazing open-source contributions on this r
- Loosing input page numbers when switching tabs on New Taxon Name task

[#1532]: https://github.com/SpeciesFileGroup/taxonworks/issues/1532
[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.40.4...development
[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.40.5...development
[0.40.5]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.40.4...v0.40.5
[0.40.4]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.40.3...v0.40.4
[0.40.3]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.40.2...v0.40.3
[0.40.2]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.40.1...v0.40.2
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ GEM
paperclip-meta (3.1.0)
paperclip (>= 5.0)
parallel (1.24.0)
parallel_tests (4.6.1)
parallel_tests (4.7.0)
parallel
parser (3.3.0.5)
ast (~> 2.4.1)
Expand Down Expand Up @@ -526,7 +526,7 @@ GEM
rspec-support (~> 3.10)
rspec-support (3.13.1)
rtesseract (3.1.3)
rubocop (1.63.2)
rubocop (1.63.3)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand Down Expand Up @@ -605,7 +605,7 @@ GEM
spreadsheet (1.3.1)
bigdecimal
ruby-ole
spring (4.2.0)
spring (4.2.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.7.3)
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/otus_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,13 @@ def autocomplete

# GET /api/v1/otus/autocomplete
def api_autocomplete
@otus = ::Queries::Otu::Autocomplete.new(
@otu_metadata = ::Queries::Otu::Autocomplete.new(
params.require(:term),
project_id: sessions_current_project_id,
with_taxon_name: params[:with_taxon_name],
having_taxon_name_only: params[:having_taxon_name_only]
).api_autocomplete
).api_autocomplete_extended


render '/otus/api/v1/autocomplete'
end
Expand Down
19 changes: 15 additions & 4 deletions app/controllers/taxon_name_relationships_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,23 @@ def taxon_name_relationship_types

# GET /api/v1/taxon_name_relationships
def api_index
@taxon_name_relationships = Queries::TaxonNameRelationship::Filter.new(params.merge!(api: true)).all
q = Queries::TaxonNameRelationship::Filter.new(params.merge!(api: true)).all
.where(project_id: sessions_current_project_id)
.order('taxon_name_relationships.id')
.page(params[:page])
.per(params[:per])
render '/taxon_name_relationships/api/v1/index'

respond_to do |format|
format.json {
@taxon_name_relationships = q.all.page(params[:page]).per(params[:per])
render '/taxon_name_relationships/api/v1/index'
}
format.csv {
@taxon_name_relationships = q
send_data Export::CSV.generate_csv(
@taxon_name_relationships,
exclude_columns: %w{updated_by_id created_by_id project_id},
), type: 'text', filename: "taxon_names_relationships_#{DateTime.now}.tsv"
}
end
end

# GET /api/v1/taxon_name_relationships/:id
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/taxon_names_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ def api_index

respond_to do |format|
format.json {
@taxon_names = q.page(params[:page]).per(params[:per])
render '/taxon_names/api/v1/index'
}
@taxon_names = q.page(params[:page]).per(params[:per])
render '/taxon_names/api/v1/index'
}
format.csv {
@taxon_names = q
send_data Export::CSV.generate_csv(
Expand Down
8 changes: 3 additions & 5 deletions app/helpers/graph_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module GraphHelper

def week_in_review(weeks)
h = {
metadata: {
metadata: {
weeks_ago: weeks,
},
data: []
}
}

%w{otus taxon_names collection_objects collecting_events biological_associations asserted_distributions type_materials images documents descriptors observations contents}.each do |i|

Expand All @@ -21,10 +21,9 @@ def week_in_review(weeks)
h[:data].push g
end

h
h
end


def objects_graph(object_scope)
g = initialize_graph(nil, nil, nil)

Expand All @@ -41,7 +40,6 @@ def objects_graph(object_scope)
g
end


def object_graph(object)
return nil if object.nil?

Expand Down
16 changes: 13 additions & 3 deletions app/helpers/otus_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ def otu_tag_elements(otu)
].compact
end

# Used exclusively in /api/v1/otus/autocomplete
def otu_extended_autocomplete_tag(target)
if target.kind_of?(Otu)
otu_tag(target)
else # TaxonName
a = [ tag.span( full_taxon_name_tag(target).html_safe, class: :otu_tag_taxon_name, title: target.id) ]
a.push taxon_name_type_short_tag(target)
tag.span( a.compact.join(' ').html_safe, class: :otu_tag )
end
end

# @return [String]
# no HTML inside <input>
def otu_autocomplete_selected_tag(otu)
Expand Down Expand Up @@ -226,11 +237,11 @@ def aggregate_geo_json(otu, target, cached_map_type = 'CachedMapItem::WebLevel1'

if gj = otu.cached_map_geo_json(cached_map_type)

i =
i =
{
**gj,
# 'type' => gj['type'], # 'Feature',

'properties' => {
'base' => {
'type' => 'Otu',
Expand All @@ -243,7 +254,6 @@ def aggregate_geo_json(otu, target, cached_map_type = 'CachedMapItem::WebLevel1'
}
}


if gj.keys.include?('coordinates')
i['coordinates'] = gj['coordinates'] # was 'coordinates' TODO: might not work
elsif gj.keys.include?('geometries')
Expand Down
2 changes: 0 additions & 2 deletions app/helpers/projects_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,8 @@ def image_cumulative_gb_per_year
cumulative_gb_per_year(Image.group_by_year(:created_at, format: '%Y').sum(:image_file_file_size))
end


def week_in_review_graphs(weeks)
content_tag(:div, '', 'data-weeks-ago': weeks, 'data-weeks-review': true)
end


end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<label>Value</label>
<label>{{ label }}</label>
<div class="field">
<textarea
v-model="text"
Expand Down Expand Up @@ -34,6 +34,13 @@
import { ref } from 'vue'
import VBtn from '@/components/ui/VBtn/index.vue'
defineProps({
label: {
type: String,
default: 'Value'
}
})
const emit = defineEmits('add')
const exact = ref()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/>
<hr class="divisor full_width" />
<AddValue
label="Value (any predicate)"
@add="
(value) => {
values.push(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
:klass="BIOLOGICAL_ASSOCIATION"
lock-button
use-session
@lock="lockSource = $event"
@lock="lock.source = $event"
/>

<DisplayList
Expand Down Expand Up @@ -64,7 +64,7 @@
small
/>
</VBtn>
<LockComponent v-model="lockRelationship" />
<LockComponent v-model="lock.relationship" />
</h3>
<h3
class="subtle relationship-title"
Expand Down Expand Up @@ -268,10 +268,11 @@ function reset() {
}
biologicalRelation.value = undefined
flip.value = false
citation.value = {
...makeEmptyCitation(),
source_id: lock.source ? citation.value.source_id : undefined,
pages: lock.source ? citation.value.pages : undefined
if (lock.source) {
citation.value.id = undefined
} else {
citation.value = makeEmptyCitation()
}
}
Expand Down Expand Up @@ -305,14 +306,16 @@ function saveAssociation() {
)
: BiologicalAssociation.create(payload)
saveRequest.then(({ body }) => {
addToList(body)
reset()
TW.workbench.alert.create(
'Biological association was successfully saved.',
'notice'
)
})
saveRequest
.then(({ body }) => {
addToList(body)
reset()
TW.workbench.alert.create(
'Biological association was successfully saved.',
'notice'
)
})
.catch(() => {})
}
function removeItem(item) {
Expand Down
13 changes: 6 additions & 7 deletions app/javascript/vue/routes/endpoints/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,16 @@ export default (model, permitParams) => ({
async all(params = {}, { useFilter } = {}) {
const makeRequest = useFilter ? this.filter : this.where
const maxPer = params.per || 500
const requests = [
await makeRequest({
...params,
per: maxPer
})
]
const payload = {
...params,
per: maxPer
}
const requests = [await makeRequest(payload)]
const { totalPages } = getPagination(requests[0])

if (totalPages > 1) {
for (let page = 2; page <= totalPages; page++) {
requests.push(makeRequest({ params: { ...params, page } }))
requests.push(makeRequest({ ...payload, page }))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const LAYOUTS = {
'cached_level1_geographic_name',
'cached_level2_geographic_name',
'verbatim_locality',
'verbatim_latititude',
'verbatim_latitude',
'verbatim_longitude',
'verbatim_geolocation_uncertainty',
'minimum_elevation',
Expand Down
Loading

0 comments on commit 9f5ae90

Please sign in to comment.