Project

General

Profile

Feature #1501

Set multiple choice types to single type

Added by Nina Richards about 1 year ago. Updated 18 days ago.

Status:
Closed
Priority:
Normal
Category:
UI
Target version:
Start date:
2021-04-23
Estimated time:

Description

It would be highly desirable to set types, that are multiple choice to single choice. So far this doesn't seem to be possible even when the data was entered solely as single choice.

Implementation
  • Types can be switched from multiple to single if it isn't used multiple times for any entity
  • A link to check multiple linked entities is provided in the type overview

History

#1

Updated by Alexander Watzinger about 1 year ago

  • Target version changed from Wishlist to 7.1.0
  • Status changed from New to Acknowledged

Thank you very much for reporting. Main reason this isn't implemented yet is that it would have to be checked (and shown) if this type is already linked multiple times to one entity. Nevertheless this is an important feature so I put it on the roadmap and an implementation draft below.

Implementation
  • Check if this type is already linked multiple times to one entity
  • If not, make checkbox multiple in update form editable so it can be deselected
  • Check again in backend before changing type to single use

To do
If a type is linked multiple times to one entity: how/where do we show it? And more importantly, where to provide a list of multiple linked entities to give a chance to clean them up?

#2

Updated by Alexander Watzinger 9 months ago

  • Description updated (diff)
#3

Updated by Alexander Watzinger 3 months ago

  • Target version changed from 7.1.0 to 7.3.0
#4

Updated by Alexander Watzinger about 2 months ago

  • Status changed from Acknowledged to Assigned
  • Assignee set to Bernhard Koschiček-Krombholz
#5

Updated by Bernhard Koschiček-Krombholz about 2 months ago

  • Status changed from Assigned to Resolved
#6

Updated by Alexander Watzinger about 2 months ago

Thank you Bernhard for implementing this.

I checked the feature_single_multiple branch, did some refactoring and removed the is_multiple() function which was getting awkward. It's a little tricky because when a form field is set to disabled no data is transmitted and it "looks" like a disabled multiple checkbox wasn't selected. Anyway, it should work as expected but you may want to test and check the changes: https://github.com/craws/OpenAtlas/commit/94d3bcbbbd3c97d16e968e5db3ebda69ed23b586

Tests and Mypy checks are fine. I also tested performance with a hierarchy with thousands of links, although it than takes 1 or 2 seconds I think that's fine. It is unlikely that a hierarchy used that much will be edited often.

Last thing remaining is a view to display entities that are linked multiple times in case someone wants to remove the multiple flag but can't. We could put a "show multiple linked entities" link for types set to multiple in the overview, maybe below the "Untyped entities" check link. You can implement it similar to the show_untyped_entities() in views/type.py

#7

Updated by Bernhard Koschiček-Krombholz about 2 months ago

I should have read the whole description. Now it should be completed. I didn't make the translations, I think they are done shortly before the release.

#8

Updated by Alexander Watzinger about 2 months ago

Yes, for minor changes I do translations and manual adaptions before the release in one go and you already prepared it correctly.
Thanks a lot for implementing, although it seems like a minor user interface improvement it had turned out to be an inconvenience a few times already.

#9

Updated by Alexander Watzinger about 2 months ago

  • Status changed from Resolved to Closed

It's already in develop, you can delete your local feature_single_multiple branch.

#10

Updated by Alexander Watzinger 18 days ago

  • Description updated (diff)

Also available in: Atom PDF