UMB-CS682-Team-02 / tracker

0 stars 1 forks source link

Add Boolean property to issues by changing schema.py #41

Closed rouilj closed 6 months ago

rouilj commented 7 months ago

Currently we can only draw charts by grouping on a field that is a Link or Multilink type.

Extend charting to include grouping of boolean type. In the database, a Boolean can be in one of three states: True, False, Not Set. To work on this, you need to add a boolean property to the schema.

An example of adding a Boolean to the user class is available at: https://roundup-tracker.org/docs/customizing.html#stop-nosy-messages-going-to-people-on-vacation

With that example as a reference, please add a private Boolean property to issues by adding:

   private=Boolean()

To the definition of an issue by modifying the arguments to the IssueClass() call.

Change the issue.item.html template to include:

<tr>
 <th>Private Issue</th>
 <td tal:content="structure context/private/field">private</td>
</tr>

between the keyword and change note fields.

Change the issue.index.html template to include:

<th tal:condition="request/show/private" i18n:translate="">Private</th>

after the assignedto header in the first row of <table class="list"> and add:

   <td tal:condition="request/show/private"
       tal:content="python:i.private.plain() or default">&nbsp;</td>

after the td tag that shows the value of assignedto that starts:

<td tal:condition="request/show/assignedto" ...

Lastly, to make it easier for you to group by Priority, change index.search.html to add:

<tr tal:define="name string:private;
                           field context/private;"
    tal:condition="db/issue/is_view_ok">
  <th i18n:translate="">Private Status:</th>
  <td></td>
  <td metal:use-macro="column_input"></td>
  <td metal:use-macro="sort_input"></td>
  <td metal:use-macro="group_input"></td>
</tr>

If you restart the tracker, you should be able to modify some of the issues to set the private flag (Boolean True), set then unset the private flag (Boolean False), or not change the private flag at all (Not Set/unknown state). Note that the default display for a Boolean in Roundup's web interface has only two values (yes, no). Unsetting a boolean is not an option and modifying an item (issue) to set an value will also set the Boolean property to False. Since the "unset" tri-value is treated as False by the internal code, this is correct, but is surprising. Some trackers do use all three Boolean values, so the charting code has to handle all three values.

If you change the private property on issues 1 and 2 to True/yes and change the private property to false on issues 3 and 4 and leave the others unchanged, the URL: http://localhost:8080/demo/issue?@sort0=activity&@group0=private&%@groupdir0=on&@columns=title,id,activity,status,assignedto,private&@filter=id&id=1,2,3,4,5,6,7,8&@pagesize=50&@startwith=0 should show you the index page with the first 8 issue grouped by the private property.

Once this is done, commit these changes so your co-workers can use it.

ashrith-UMB commented 6 months ago

We can now set private flag properties and able to group the issues using the Boolean properties.

commit : https://github.com/UMB-CS682-Team-02/tracker/commit/921d96b900d28c2e54f1abed590a34e48434e8da