Patient Flags Descriptor enables Flags on Start of Module

We have been having an issue of patient flags enabling the flags automatically when ever it starts even after disabling them via the interface. We discovered that this is attributed to the Descriptor which has the flags enabled automatically on start.

public Boolean enabled() { return Boolean.TRUE; }

Wondering what would be the best approach removing the option of automatic enable of flags on start. @dkayiwa @maimoonak @ssmusoke Any thoughts

What do you have in mind?

Removing the enabled method from the Descriptor

Can you share a link to the line of code that you are referring to?

This is the Code Class I am referring to

There is a possibility of having the method an abstract.

That looks like simply making flags enabled by default. But then overridden by the value stored in the database. https://github.com/openmrs/openmrs-module-patientflags/blob/7e59726ed24535ae97a1472d94de1c5c02a40082/api/src/main/java/org/openmrs/module/patientflags/db/hibernate/HibernateFlagDAO.java#L61

And default when ever the module starts yes @dkayiwa. which doesn’t make sense for the available function of disabling the flags

Aren’t flags stored and hence loaded from the database?

@dkayiwa Flags are computed on the fly its the query that executes them that is stored.

What could be the use of this? https://github.com/openmrs/openmrs-module-patientflags/blob/7e59726ed24535ae97a1472d94de1c5c02a40082/api/src/main/java/org/openmrs/module/patientflags/db/hibernate/HibernateFlagDAO.java#L61

@dkayiwa Its a get method according to method name and what the DAO method does…

Isn’t that method retrieving a flag that is already stored in the database?

Yes It does.

So the database stored enabled value will override the default one.

@dkayiwa Yes That is true

Therefore, if you say that a flag, which was disabled and saved in the database as so, comes out enabled, then you need to check the database to confirm that your changes were persisted.