Question

Photo of DJ Grick

0

Liquid Badge for Background checks

I have been messing with a liquid badge trying to add a thumbs up if someone has a valid child abuse clearance but for some reason no matter what i do I get the same results for everyone. 

Where did i go wrong? 

{% if  {Person | Attribute:'BackgroundCheckResults'} == 'Pass' -%}
                    <div class="badge badge-Child-Worker" data-original-title="{{ Person.NickName }} has a child abuse clearance on file from {{ Person | Attribute:'BackgroundCheckDate' }}.">
                        <i class="badge-icon fa fa-thumbs-o-up"></i>
                    </div>
    {% endif -%}

  • Photo of Mason Kinyon

    0

    Liquid unfortunately doesn't allow you to use filters inside of an IF statement.  What you can do though is to pass the filter as a variable and use the variable in the IF statement.

    {% assign attribute = Person | Attribute:'BackgroundCheckResults' %}

    {% if attribute == 'Pass %}
    ...

     

    • DJ Grick

      I wish I could say that worked...but it didn't. Using this returned nothing. There has to be something else I am missing. I have made several other liquid badges and never had an issue.

    • DJ Grick

      Turns out I didn't need an s at the end of "BackgroundCheckResult". Thanks for the help!

  • Photo of Bronson Witting

    0

    For what it's worth, I'm doing the same thing, but using the Is Background Checked attribute:

     

    {% if Person.BackgroundChecked == "Yes" -%}
                        <div class="badge badge-background" data-original-title="{{ Person.NickName }}  completed a Background Check {{ Person.BackgroundCheckDate | HumanizeDateTime }}">
                            <i class="badge-icon fa fa-file-text"></i>
                        </div>
                    {% else -%}
                        <div class="badge badge-background" data-original-title="{{ Person.NickName }} doesn't have a Background Check on file.">
                            <i class="badge-icon badge-disabled fa fa-file-text"></i>
                        </div>
                    {% endif -%}

     

    The only thing that I see that is different (besides me needing to update the way I access attributes!) is that I used double quotes around my comparison and you used single.  See if that makes a difference?

    • DJ Grick

      Is this working for you? I had read in the debug badge info that background checks needed called for with { Person | Attribute:"BackgroundCheckDate' } I had tried just using Person.BackgroundCheckResults but it never worked. It returned that everyone passed.


      Also I didn't just want to search off date of the check because we WILL have people fail, but the badge won't know they failed.

    • DJ Grick

      Sorry I just saw that you had mentioned you need to update the way you access attributes. Let me know if you get it working. Also I like that you humanize the date. I always forget about that cool feature.