Skip to content

Commit

Permalink
Merge branch 'hotfix-bulk_verify'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnvanbreda committed Dec 19, 2018
2 parents 85439a6 + b339f0d commit b359b48
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 11 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
* @var string
*/
$config['version'] = '2.2.0';
$config['version'] = '2.2.1';

/**
* Version release date.
Expand Down
4 changes: 3 additions & 1 deletion application/libraries/ReportEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,9 @@ private function getFilterClause($field, $datatype, &$operator, &$value, $filter
// Ensure filter clause reflects any current parameter values.
$replacements = array();
foreach ($this->providedParams as $paramName => $paramVal) {
$replacements["/#$paramName#/"] = $paramVal;
if (!is_array($paramVal)) {
$replacements["/#$paramName#/"] = $paramVal;
}
}
$field = preg_replace(array_keys($replacements), array_values($replacements), $field);
if ($datatype === 'text' || $datatype === 'species') {
Expand Down
29 changes: 25 additions & 4 deletions application/models/base_licensed_medium.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
class Base_licensed_medium_Model extends ORM {

/**
* Fill in licence link before submission.
* Fill in licence link and media type default before submission.
*
* If a submission is for an insert and does not contain the licence ID for
* the data it contains, look it up from the user's settings and apply it to
* the submission.
* the submission. If the media_type_id is not populated, default to
* the ID for image:local.
*/
protected function preSubmit() {
if (!array_key_exists('id', $this->submission['fields']) || empty($this->submission['fields']['id']['value'])) {
Expand All @@ -46,15 +47,35 @@ protected function preSubmit() {
$row = $this->db
->select('media_licence_id')
->from('users_websites')
->where(array(
->where([
'user_id' => $userId,
'website_id' => $this->identifiers['website_id'],
))
])
->get()->current();
if ($row) {
$this->submission['fields']['licence_id']['value'] = $row->media_licence_id;
}
}
// Now fill in the media_type_id if not in submission.
if (!array_key_exists('media_type_id', $this->submission['fields'])
|| empty($this->submission['fields']['media_type_id']['value'])) {
$cache = Cache::instance();
if ($cached = $cache->get('image:local media_type_id')) {
$mediaTypeId = $cached;
}
else {
$mediaTypeId = $this->db
->select('id')
->from('cache_termlists_terms')
->where([
'termlist_title' => 'Media types',
'term' => 'Image:Local',
])
->get()->current()->id;
$cache->set('image:local media_type_id', $mediaTypeId);
}
$this->submission['fields']['media_type_id'] = ['value' => $mediaTypeId];
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ DELETE FROM work_queue WHERE task IN (
);

INSERT INTO work_queue (task, entity, record_id, priority, cost_estimate, created_on)
SELECT DISTINCT 'task_cache_builder_attrs_occurrence', 'occurrence', id, 2, 60, now()
SELECT DISTINCT 'task_cache_builder_attrs_occurrence', 'occurrence', id, 3, 60, now()
FROM occurrences
WHERE deleted=false;

INSERT INTO work_queue (task, entity, record_id, priority, cost_estimate, created_on)
SELECT DISTINCT 'task_cache_builder_attrs_sample', 'sample', id, 2, 60, now()
SELECT DISTINCT 'task_cache_builder_attrs_sample', 'sample', id, 3, 60, now()
FROM samples
WHERE deleted=false;

INSERT INTO work_queue (task, entity, record_id, priority, cost_estimate, created_on)
SELECT DISTINCT 'task_cache_builder_attrs_taxa_taxon_list', 'taxa_taxon_list', ttl.id, 2, 60, now()
SELECT DISTINCT 'task_cache_builder_attrs_taxa_taxon_list', 'taxa_taxon_list', ttl.id, 3, 60, now()
FROM taxa_taxon_lists ttl
--May as well skip any without an attribute.
JOIN taxa_taxon_list_attribute_values av on av.taxa_taxon_list_id=ttl.id and av.deleted=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public static function process($db, $taskType, $procId) {
JOIN terms ti18n ON ti18n.id=tlti18n.term_id AND ti18n.deleted=false
JOIN languages l on l.id=ti18n.language_id AND l.deleted=false AND l.iso='$lang'
) ON tlti18n.meaning_id=tlt.meaning_id AND tlti18n.termlist_id=tlt.termlist_id and tlti18n.deleted=false
WHERE a.data_type='L'
WHERE q.entity='taxa_taxon_list' AND q.task='task_cache_builder_attrs_taxa_taxon_list' AND q.claimed_by='$procId'
AND a.data_type='L'
GROUP BY taxa_taxon_list_id, taxa_taxon_list_attribute_id, a.multi_value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
DELETE FROM work_queue WHERE task='task_spatial_index_builder_sample';

INSERT INTO work_queue (task, entity, record_id, priority, cost_estimate, created_on)
SELECT DISTINCT 'task_spatial_index_builder_sample', 'sample', id, 2, 60, now()
SELECT DISTINCT 'task_spatial_index_builder_sample', 'sample', id, 3, 60, now()
FROM samples
WHERE deleted=false;

0 comments on commit b359b48

Please sign in to comment.