ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Building a Bug Tracker: Filtering by Assignment

June 19, 2008 10:08pm

Subscribe [1]
  • #1 / Jun 19, 2008 10:08pm

    Lisa Wess

    20502 posts

    Within a bug tracker, it can often be helpful to see who the bug is assigned to.  For this reason, we set up the bug_tracker_assignment custom field.  Now we’re going to implement filtering by that custom field.

    In fact, the structure is already in place, so this will be extremely easy to add; it is just a matter of a few conditionals and a few links.  Ready?

    Onwards!

  • #2 / Jun 20, 2008 2:12pm

    qlas

    33 posts

    Thanks a lot Lisa for this new chapter of the bug tracker tutorial.
    It shows again the power and easyness of Expression Engine and
    motivates me to do more and better on my own websites.
    :coolsmile:

  • #3 / Jan 13, 2009 8:02pm

    los1sol

    41 posts

    Lisa, I followed your tutorial as best as I could but I’m having problems with this last part. Is the final index template supposed to resemble something like this: (I changed the status to match my own needs but everything else should be the same).

    {html_begin}
    
    {embed="inc/.head" title="Bug Tracker - {segment_4} {segment_3}"}
    
    <body>
    <div id="container">
    {embed="inc/.banner"}
    {embed="inc/.leftnav"}
    <div id="content">
    
    {!-- Filter Reported Bugs by Severity --}
    
    {if segment_3 == "severity" OR segment_3 == "assignment"}
    {exp:weblog:entries weblog="{bug_tracker_weblog}" limit="30" status="Open|New|Closed|Fixed" sort="desc" search:bug_tracker_{segment_3}="={segment_4}" dynamic="off"}
    {if no_results}
    {if segment_3 != "assignment"}
    No bugs of {segment_4} {segment_3}.
    {if:elseif segment_3 == "assignment"}
    There are no bugs assigned to {segment_4}.
    {/if}
    {/if}
    {if count == "1"}
    {if segment_3 != "assignment"}
    <h3>Filtering by {segment_4} {segment_3}</h3>
    <p>{if:elseif segment_3 == "assignment"}</p><h3>Bugs assigned to {segment_4}</h3>
    <p>{/if}<br />
    <table><br />
    <tr><br />
    <th>ID</th><br />
    <th>Status</th><br />
    <th>Version</th><br />
    <th>Description</th><br />
    </tr><br />
    {/if}<br />
    <tr><br />
    <td>{entry_id}</td><br />
    <td>{status}</td><br />
    <td>{bug_tracker_version}</td><br />
    <td>{title}</td><br />
    </tr><br />
    {if count == total_results}<br />
    </table><br />
    {/if}<br />
    {/exp:weblog:entries}<br />
    {/if}</p>
    
    <p>{!-- Filter Reported Bugs by Status --}</p>
    
    <p>{if segment_3 == "status"}<br />
    {exp:weblog:entries weblog="{bug_tracker_weblog}" limit="30" status="{segment_4}" sort="desc" dynamic="off"}<br />
    {if no_results}<br />
    No bugs of {segment_4} {segment_3}.<br />
    {/if}<br />
    {if count == "1"}</p><h3>Filtering by {segment_4} {segment_3}</h3>
    <p><table><br />
    <tr><br />
    <th>ID</th><br />
    <th>Status</th><br />
    <th>Version</th><br />
    <th>Description</th><br />
    </tr><br />
    {/if}<br />
    <tr><br />
    <td>{entry_id}</td><br />
    <td>{status}</td><br />
    <td>{bug_tracker_version}</td><br />
    <td>{title}</td><br />
    </tr><br />
    {if count == total_results}<br />
    </table><br />
    {/if}<br />
    {/exp:weblog:entries}<br />
    {/if}</p>
    
    <p>{!-- End Bug List --}<br />
    </div><br />
    {embed="inc/.footer"}<br />
    </div><br />
    {html_end}

  • #4 / Jan 13, 2009 9:30pm

    los1sol

    41 posts

    Ok, nevermind. I found the problem. I had a different Assigned To custom field and had accounted for that in the .inf/leftnav but had switched the placement of the variables. I stupidly thought i could connect the two with member names.

  • #5 / Jan 13, 2009 10:05pm

    Lisa Wess

    20502 posts

    Glad you were able to figure it out, los1sol!

  • #6 / Jan 15, 2009 2:47pm

    los1sol

    41 posts

    If I wanted to use the existing structure of the filter_by template to filter by Category, do you think I would be better off using the {category_name} variable or should I create a new custom field?

    What would be easiest?

  • #7 / Jan 15, 2009 2:49pm

    Lisa Wess

    20502 posts

    Honestly, easiest would be using ExpressionEngine’s built-in methodologies for this.  The bug tracker tutorial uses embeds so that having multiple templates doesn’t equate to having more maintenance.  Or you could filter your categories directly through the index as is done in the default templates.

  • #8 / Jan 21, 2009 4:27pm

    los1sol

    41 posts

    Hi Lisa, I had managed to get some sort of category filtering accomplished via the .leftnav template using

    <li>Category</li>
            <ul>
                <li><a href="http://{path=">Copy</a></li>
                <li><a href="http://{path=">Database</a></li>
                <li><a href="http://{path=">Flash</a></li>
                <li><a href="http://{path=">HTML</a></li>
            </ul>
    </ul>

    However, if I want this bug tracker to have more than 1 weblog (each client would be restricted to their own weblog), I need to filter categories using the filter_by template otherwise it will give me all entries under those particular categories regardless of weblog.

    How do you suppose I go about doing this? I gave it a shot using the filter by severity and status as a blueprint but it didn’t work.

    See the section under {!-- Filter Reported Bugs by Category --} for my attempt at getting this to work:

    {html_begin}
    
    {embed="bug_tracker/.head" title="Bug Tracker - {segment_4} {segment_3}"}
    
    <body>
    <div id="container">
    {embed="bug_tracker/.banner"}
    {embed="bug_tracker/.leftnav"}
    <div id="content">
    
    {!-- Filter Reported Bugs by Severity --}
    
    {if segment_3 == "severity" OR segment_3 == "assignment"}
    {exp:weblog:entries weblog="{bug_tracker_weblog}" limit="30" status="Open|New|Closed|Fixed" sort="desc" search:bug_tracker_{segment_3}="={segment_4}" dynamic="off"}
    {if no_results}
    {if segment_3 != "assignment"}
    No bugs of {segment_4} {segment_3}.
    {if:elseif segment_3 == "assignment"}
    There are no bugs assigned to {segment_4}.
    {/if}
    {/if}
    {if count == "1"}
    {if segment_3 != "assignment"}
    <h3>Filtering by {segment_4} {segment_3}</h3>
    <p>{if:elseif segment_3 == "assignment"}</p><h3>Bugs assigned to {segment_4}</h3>
    <p>{/if}<br />
    <table><br />
    <tr><br />
    <th>ID</th><br />
    <th>Status</th><br />
    <th>Category</th><br />
    <th>Description</th><br />
    <th>Date</th><br />
    </tr><br />
    {/if}<br />
    <tr><br />
    <td><a href="http://{permalink=bug_tracker/bug_detail}?id={entry_id}">{entry_id}</a></td><br />
    <td>{status}</td><br />
    <td>{categories}{category_name}{/categories}</td><br />
    <td>{title}</td><br />
    <td>{entry_date format="%m/%d/%y"}</td><br />
    </tr><br />
    {if count == total_results}<br />
    </table><br />
    {/if}<br />
    {/exp:weblog:entries}<br />
    {/if}</p>
    
    <p>{!-- Filter Reported Bugs by Status --}</p>
    
    <p>{if segment_3 == "status"}<br />
    {exp:weblog:entries weblog="{bug_tracker_weblog}" limit="30" status="{segment_4}" sort="desc" dynamic="off"}<br />
    {if no_results}<br />
    No{segment_4} bugs.<br />
    {/if}<br />
    {if count == "1"}</p><h3>Filtering by {segment_4} {segment_3}</h3>
    <p><table><br />
    <tr><br />
    <th>ID</th><br />
    <th>Status</th><br />
    <th>Category</th><br />
    <th>Description</th><br />
    <th>Date</th><br />
    </tr><br />
    {/if}<br />
    <tr><br />
    <td><a href="http://{permalink=bug_tracker/bug_detail}?id={entry_id}">{entry_id}</a></td><br />
    <td>{status}</td><br />
    <td>{categories}{category_name}{/categories}</td><br />
    <td>{title}</td><br />
    <td>{entry_date format="%m/%d/%y"}</td><br />
    </tr><br />
    {if count == total_results}<br />
    </table><br />
    {/if}<br />
    {/exp:weblog:entries}<br />
    {/if}</p>
    
    <p>{!-- Filter Reported Bugs by Category --}</p>
    
    <p>{if segment_3 == "categories"}<br />
    {exp:weblog:entries weblog="{bug_tracker_weblog}" limit="30" categories="{segment_4}" sort="desc" dynamic="off"}<br />
    {if no_results}<br />
    No{segment_4} bugs.<br />
    {/if}<br />
    {if count == "1"}</p><h3>Filtering by {segment_4} {segment_3}</h3>
    <p><table><br />
    <tr><br />
    <th>ID</th><br />
    <th>Status</th><br />
    <th>Category</th><br />
    <th>Description</th><br />
    <th>Date</th><br />
    </tr><br />
    {/if}<br />
    <tr><br />
    <td><a href="http://{permalink=bug_tracker/bug_detail}?id={entry_id}">{entry_id}</a></td><br />
    <td>{status}</td><br />
    <td>{categories}{category_name}{/categories}</td><br />
    <td>{title}</td><br />
    <td>{entry_date format="%m/%d/%y"}</td><br />
    </tr><br />
    {if count == total_results}<br />
    </table><br />
    {/if}<br />
    {/exp:weblog:entries}<br />
    {/if}</p>
    
    <p>{!-- End Bug List --}</p>
    
    <p></div><br />
    {embed="bug_tracker/.footer"}<br />
    </div><br />
    {html_end}

    Any idea what’s going on?

  • #9 / Jan 21, 2009 4:58pm

    Lisa Wess

    20502 posts

    los1sol:

    each client would be restricted to their own weblog

    At this point before I can assist, I’d strongly recommend emailing sales regarding your ExpressionEngine usage, as I have some license concerns.

  • #10 / Jan 21, 2009 5:07pm

    los1sol

    41 posts

    I have been assured by my company that they will buy the commercial license as soon as I show them a working version of the bug tracker. It’s worthless without it because it requires multiple user access anyway. I have no intention of using the CORE version for this. It isn’t even my money…

  • #11 / Jan 21, 2009 5:16pm

    Lisa Wess

    20502 posts

    Please email sales, los1sol, thank you. 

    In regards to your actual setup, it’d be better in a separate How To post as you’ve gone quite far afield into customizing this for your own use.  I’d recommend a bare minimum template for testing as well.  Again, I’d actually recommend a separate template for your category filtering, and using embeds to manage repeated code.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases