Skip to content

Commit

Permalink
more concise description code
Browse files Browse the repository at this point in the history
  • Loading branch information
zihehuang committed Nov 16, 2022
1 parent 3a13f45 commit 0e285e8
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions contracts/TopShot.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -709,14 +709,9 @@ pub contract TopShot: NonFungibleToken {
/// The description of the Moment. If Tagline property of the play is empty, compose it using the buildDescString function
/// If the Tagline property is not empty, use that as the description
pub fun description(): String {
let playDesc: String? = TopShot.getPlayMetaDataByField(playID: self.data.playID, field: "Tagline")
let playDesc: String? = TopShot.getPlayMetaDataByField(playID: self.data.playID, field: "Tagline") ?? ""

if let desc = playDesc {
if desc.length > 0 {
return desc
}
}
return self.buildDescString()
return playDesc.length > 0 ? playDesc : self.buildDescString()
}

// All supported metadata views for the Moment including the Core NFT Views
Expand Down

0 comments on commit 0e285e8

Please sign in to comment.