function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sherry pengsherry peng 

Error: The BoatReview component doesn't include a public attribute named boat of type BoatType__c.

In Lightning Component Framework Specialist SuperBadge - Challenge 8, I got following error:
The BoatReview component doesn't include a public attribute named boat of type BoatType__c.
Best Answer chosen by sherry peng
sherry pengsherry peng
I waste hours on fixing it. The error message is misleading. Actually it is looking for a public attribute named boat of type Boat__c on BoatReviews component. 

For this super badge, no need to create a BoatReview component. 

Post here to save your time if you got this error also. 

All Answers

sherry pengsherry peng
I waste hours on fixing it. The error message is misleading. Actually it is looking for a public attribute named boat of type Boat__c on BoatReviews component. 

For this super badge, no need to create a BoatReview component. 

Post here to save your time if you got this error also. 
This was selected as the best answer
Sudipta Ghosh 9Sudipta Ghosh 9
@sherry peng
Could you please help me, I am getting the same error

Challenge Not yet complete... here's what's wrong: 
The BoatReview component doesn't include a public attribute named boat of type BoatType__c.
8
umesh atryumesh atry
HI Sudipta, Please replace these code with your code... I am sednig only 4 lines from start rest you can update your code.
<aura:component controller="BoatReviews">
	<aura:attribute name="boat" type="Boat__c" access="public"/>
    <aura:attribute name="boatReviews" type="BoatReview__c[]" access="private"/>
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:handler name="change" value="{!v.boat}" action="{!c.doInit}"/>
----<add your code>
----<add your code>
----<add your code>

 
janardhanareddy gowkanpallijanardhanareddy gowkanpalli
Hi  umesh atry

Could please help me  Lightning componet badge 8  and send if you have code boatreviews Component Code
harsh choudharyharsh choudhary
BoatReviews.cmp
<aura:component controller="BoatReviews">
	<aura:attribute name="boat" type="Boat__c" access="public"/>
    <aura:attribute name="boatReviews" type="BoatReview__c[]" access="private"/>
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:handler name="change" value="{!v.boat}" action="{!c.doInit}"/>
     <aura:method name="refresh" action="{!c.doInit}"> 
     </aura:method>
    
    <aura:if isTrue="{!v.boatReviews.length==0}">
    	<lightning:layoutItem class="slds-align_absolute-center" flexibility="auto" padding="around-small">   
              <ui:outputText value="No reviews available" />
        </lightning:layoutItem>
    </aura:if>
  <div class="slds-feed">
	<ul class="slds-feed__list">
         <ui:scrollerWrapper class="scrollerSize">
       <aura:iteration items="{!v.boatReviews}" var="review">
          
		<li class="slds-feed__item slds-scrollable_y">    
    		<article class="slds-post">
            	<header class="slds-post__header slds-media">
                <div class="slds-media__figure">
                    <a href="javascript:void(0);" class="slds-avatar slds-avatar_circle slds-avatar_large">
                        <img alt="{!review.CreatedBy.Name}" src="{!review.CreatedBy.SmallPhotoUrl}" title="{!review.CreatedBy.Name}"  />
                    </a>
                </div>
                <div class="slds-media__body">
                        <div class="slds-grid slds-grid_align-spread slds-has-flexi-truncate">
                            <p><a data-userid="{!review.CreatedBy.Id}" href="javascript:void(0);" title="{!review.CreatedBy.Name}" onclick="{!c.onUserInfoClick}">
                                {!review.CreatedBy.Name}
                                </a> 
                                — {!review.CreatedBy.CompanyName}
                            </p>
                        </div>
                    	<p class="slds-text-body_small">
                            <lightning:formattedDateTime value="{!review.LastModifiedDate}" year="numeric" month="short" day="numeric"  hour="2-digit" minute="2-digit" second="2-digit" />
                    	</p>
                    </div>
            </header>
             <div class="slds-post__content slds-text-longform">
                 <p class="slds-text-title_caps">{!review.Name}</p>
                 
                 <p class="slds-text-body_small"><lightning:formattedRichText value="{!review.Comment__c}"/> </p>
			</div>
             <footer class="slds-post__footer">
	<ul class="slds-post__footer-actions-list slds-list_horizontal">
		<li class="slds-col slds-item slds-m-right_medium">
			<c:FiveStarRating aura:id="FiveStarRating" value="{!BoatReview.Rating__c}" readonly="true"/>
		</li>
		
	</ul>
                 
</footer>
    		</article>
          </li>
          
        </aura:iteration>
              </ui:scrollerWrapper>
    </ul>
  </div>
</aura:component>
BoatReviewsController.js
({
	onUserInfoClick : function(component,event,helper){
        var userId = event.currentTarget.getAttribute("data-userid");
        var navEvt = $A.get("e.force:navigateToSObject");
        navEvt.setParams({
            "recordId" : userId,
        });
        navEvt.fire()

    },
    doInit : function(component,event,helper){
        console.log("BRCjs: doInit");
        helper.onInit(component, event);
    },
    refresh : function(component,event,helper){
        console.log("refresh called")
        this.doInit;
    }
})
BoatReiewsHelper.js
({
	onInit : function(component, event){
                var boat = component.get("v.boat");
                console.log("BRHjs:onInit started: boatId is " + boat.Id);
                var action = component.get("c.getAll");
                action.setParams({"boatId" : boat.Id});
                console.log("boatId: " + boat.Id);

                //add the callback behavior for when the response is received
                action.setCallback(this,function(response){
                    var state = response.getState();
                    if (state === "SUCCESS"){
                        component.set("v.boatReviews", response.getReturnValue());
                        console.log("APEX success");
                        }
                        else {
                        console.log("Failed with state: " + state);
                        }
                });
                //send action off to be executed in APEX
                $A.enqueueAction(action);
    },
})
boatReviwes.auradoc
<aura:documentation>
	<aura:description>Documentation</aura:description>
	<aura:example name="ExampleName" ref="exampleComponentName" label="Label">
		Example Description
	</aura:example>
</aura:documentation>
boatreview.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
	<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
		<path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E"/>
		<path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF"/>
	</g>
</svg>
Hopefully , you will be able to complete not only 8 steps but also next steps.....

Cheers....
Happy Coding......
Best of luck--------------------Umesh Atry





 
harsh choudharyharsh choudhary
dont forgot to inclode controller which is already copied in another form.....
 
public with sharing class BoatReviews
{
    @AuraEnabled
    public static List<BoatReview__c>  getAll(String boatTypeId)
    {
        
        return [SELECT Id, Comment__c,Rating__c,CreatedBy.Id,CreatedBy.Name,CreatedBy.SmallPhotoUrl,CreatedBy.CompanyName,LastModifiedDate,CreatedDate from BoatReview__c where Boat__c =: boatTypeId];
    }
}
CHeers....
 
janardhanareddy gowkanpallijanardhanareddy gowkanpalli
HI 
am getting below error , please help anyone

Challenge Not yet complete... here's what's wrong: 
The BoatDetails controller's onBoatReviewAdded() function doesn't invoke the BoatReviews component's refresh() method.
sherry pengsherry peng
@janardhanareddy gowkanpalli,

My onBoartReviewAdded method in the controller:
onBoatReviewAdded : function(component, event, helper) {
	    console.log("BoatDetails - onBoatReviewAdded()");
	    component.set("v.selectedTabId", "boatreviewtab");

	    //invoke refresh() method
        var reviewsCmp = component.find("boatReviewsCmp");
        console.log("reviewsCmp: " + reviewsCmp);
        if(reviewsCmp) {
            reviewsCmp.refresh();
        }
}
The BoatDetails component should handle two events:
<aura:handler action="{!c.onBoatSelected}" event="c:BoatSelected"/>
 <aura:handler action="{!c.onBoatReviewAdded}" event="c:BoatReviewAdded" name="BoatReviewAdded" />


 
janardhanareddy gowkanpallijanardhanareddy gowkanpalli
@sherry peng

Thanks  it is completed badge 8
Hilma FrazeeHilma Frazee

Challenge Not yet complete... here's what's wrong: 
The BoatDetails component doesn't instantiate the BoatReviews component, passing in the selected boat information.
Close errors

I am not able to clear this step. Please help me.
Tuba MahmoodTuba Mahmood
The BoatDetails component doesn't instantiate the BoatReviews component, passing in the selected boat information...don't know the cause of this error.