Fieldtype, Module

Archived
Forum
(read-only)

eeXam

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Coffee Bean Design

     

Possible to have a conditional on the results page?

Support Request

tunnel7
tunnel7

Hello.  Have been running eeXam on this client’s site for over a year now and things are going smoothly.  Today they called with a question I need a little direction.  Currently this is the global test results template code:

{exp:channel:entries channel="trainings" limit="1"}
   
    
<h1>{title}</h1
      
    
    
{if tr-test:total_attempts != "0"}
   
     
<!-- Show the test result and answers -->
     
     <
p><strong>You have completed this test.  Your score is {tr-test:latest_percent_round}%.  You will receive an email with these results momentarily.</strong></p>
       
       
     <
h3>Your Answers</h3>
       
     
{tr-test mode="answers" attempt_id "latest"}
       
      
<p>
       
       <
strong>{number}</strong{label}<br />     
       <
strong><em>{answer} </em>- {correct_text}</strong>
         
      </
p>    
       
     
{/tr-test}
      
     
    {if
:else}
    
     
<h3>You have not yet attempted this test.</h3>
    
    
{/if}
   
   {
/exp:channel:entries} 

Regardless of pass or fail the user is shown the answers for educational purposes to study and retake.  Today the client is trying to get this approved for continuing education credits and they got dinged on the fact that the answers are shown after the test is taken (regardless of pass fail).

My questions are:

1. Is it possible to create a conditional in this template based on a specific test so that for just a select test or two the user isn’t shown the answers unless they pass (they like how it currently works for most tests)?

2. Outside of that, could a global template revision be applied so that the answers are only shown if the user passes the test?

Thanks in advance.

 

Coffee Bean Design
# 1
Developer
Coffee Bean Design

Hi there,

I’m glad you have been using the add-on successfully.  You could add an extra custom to the channel then do a conditional based on that i.e.

{if show_answers == "y"}

<!-- show answers -->


{else}

<!-- show message -->

{/if} 

Or, based on the pass/fail:

{if passed}

{else}

{
/if} 

...or a combination of them both if you need.  See the documentation on tag variables for further info.

tunnel7
# 2
tunnel7

Thanks for the reply.  This makes sense and is actually much easier than what I was thinking.  I’ll work on prototyping this out and will get back in touch if I have any questions.

Jasper McComas
# 3
Jasper McComas

It is always advisable to get feedback from professional writers, who are able to assist you write an incredibly high quality essay. Since anyone’s life is full of many different events, it may become difficult to focus on bestessays as a student. In such instances, students may face issues that create a bad impact on their academic performance.