← Back to team overview

dhis2-devs team mailing list archive

Re: Inconsistent name while retrieving category option combos

 

Hi Morten,

Thanks for the quick reply.

We saw the code. It is getting the names of category options in a HashSet
and generating the names iterating over it. We get different names since
HashSet is not ordered.

Would it be a good idea to return the exact same response each time for the
same query parameter? We can do this by converting the Set to a List and
sorting it alphabetically. Let us know what you think. If you are ok with
this approach, we would like to submit a patch for it.


Thanks,
Mansi




On Wed, Jul 16, 2014 at 2:22 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
wrote:

> Hi Mansi,
>
> Names for DataElementCategoryOptionCombo are not persisted, but rather
> generated on the fly. Please have a look
> at DataElementCategoryOptionCombo.getName.
>
> I don't know exactly why this is, I will let Lars add to it.
>
> --
> Morten
>
>
> On Wed, Jul 16, 2014 at 3:41 PM, Mansi Singhal <msinghal@xxxxxxxxxxxxxxxx>
> wrote:
>
>> Hi,
>>
>> We are creating category option combos by posting the following JSON to
>> /api/metadata.
>>
>> {
>>     "categoryOptionCombos": [{
>>         "id": "cdf922cc47b",
>>         "categoryCombo": {
>>             "name": "A and B",
>>             "id": "abe84f2cf8e"
>>         },
>>         "name": "(abc, def)",
>>         "categoryOptions": [{
>>             "id": "z2ab39bcfd7",
>>             "name": "abc"
>>         }, {
>>             "id": "c78bd47f6af",
>>             "name": "def"
>>         }]
>>     }]
>> }
>>
>> When we are trying to GET the category option combos using
>> /api/categoryOptionCombos, the name we get is inconsistent with every call.
>> We are getting (abc, def) for some times and (def, abc) some other times.
>>
>> Is this the intended behavior? Shouldn't the name retrieved be the same
>> as the name POSTed as is the case for every other metadata?
>>
>>
>> --
>> Regards,
>> Mansi Singhal
>>
>>
>>
>

Follow ups

References