Project

General

Profile

Actions

Feature #1501

closed

Set multiple choice types to single type

Added by Nina Richards almost 3 years ago. Updated almost 2 years 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
Actions #1

Updated by Alexander Watzinger almost 3 years 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?

Actions #2

Updated by Alexander Watzinger over 2 years ago

  • Description updated (diff)
Actions #3

Updated by Alexander Watzinger about 2 years ago

  • Target version changed from 7.1.0 to 7.3.0
Actions #4

Updated by Alexander Watzinger about 2 years ago

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

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

  • Status changed from Assigned to Resolved
Actions #6

Updated by Alexander Watzinger about 2 years 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

Actions #7

Updated by Bernhard Koschiček-Krombholz about 2 years 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.

Actions #8

Updated by Alexander Watzinger about 2 years 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.

Actions #9

Updated by Alexander Watzinger about 2 years ago

  • Status changed from Resolved to Closed

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

Actions #10

Updated by Alexander Watzinger almost 2 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF