Skip to content

Commit

Permalink
fixed a bug where consensus classifications could not be selected whe…
Browse files Browse the repository at this point in the history
…n there was no previous consensus classification
  • Loading branch information
MarvinDo committed Oct 10, 2023
1 parent 64cfe8c commit e5a8936
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/frontend_celery/webapp/static/js/classify.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function preselect_literature() {
}
// add literature directly for consensus classification
if (classification_type === 'consensus') {
var all_user_classifications = previous_classifications[-1]
var all_user_classifications = previous_classifications[-1] ?? {}
var selected_classification = all_user_classifications[scheme] ?? {}
var previous_selected_literature = selected_classification['literature'] ?? []
var submitter = selected_classification['submitter'] ?? {}
Expand Down Expand Up @@ -406,7 +406,8 @@ function set_default_strengths() {
function preselect_criteria_from_database(scheme) {
//const user_id = Object.keys(previous_classifications)[0]
if (classification_type === 'consensus') {
var current_scheme_with_info = previous_classifications[-1][scheme] // use imaginary consensus classification user id
var current_scheme_with_info = previous_classifications[-1] ?? {} // use imaginary consensus classification user id
current_scheme_with_info = current_scheme_with_info[scheme]
} else {
var current_scheme_with_info = previous_classifications[logged_in_user_id][scheme]
}
Expand Down

0 comments on commit e5a8936

Please sign in to comment.