Reputation: 645
Scala/Play error @Overloaded method value [tuple] cannot be applied to: Please see below code
def getPropertyFromRequest(implicit request: Request[AnyContent]): (Property, Option[ObjectId], Option[ObjectId], Option[ObjectId]) = {
val p =
Form(tuple(
"desc" -> text,
"url" -> text,
"image" -> text,
"price" -> text,
"sqft" -> text,
"address2" -> text,
"lotsize" -> text,
"taxes" -> text,
"status" -> optional(text),
"maint" -> text,
"address" -> text,
"mls" -> text,
"baths" -> text,
"beds" -> text,
"partial_baths" -> text,
"propertyId" -> optional(text),
"snoopId" -> optional(text),
"year_built" -> text,
"groupId" -> optional(text) //upon adding this, error show up
)).bindFromRequest().fold(
errors => {Logger.error(errors.toString())
throw new Error("could not parse form")},
success => success
)
val a = GeoCoder.create(p._11 + " " + p._6)
val property = Property(url = p._2,
description = p._1,
image = p._3,
price = parseAmount(p._4).toDouble,
sqft = p._5,
lotSize = p._7,
taxes = parseAmount(p._8),
status = PropertyStatus.ACTIVE,
maintenance = parseAmount(p._10),
mls = p._12,
baths = try{p._13.toDouble}catch{case e => 0},
beds = try{p._14.toInt}catch{case e=> 0},
partialBaths = try{p._15.toInt}catch{case e => 0},
address = a,
yearBuilt = Some(p._18))
( property, p._16.map(new ObjectId(_)) ,p._17.map(new ObjectId(_)), p._19.map(new ObjectId(_)) )
}
Note: This code is working correctly but upon adding groupID on tuple list, error show up. according to my research tuple is up 22max element only, but this one is up to 19 counts, so not sure whats happening.
Thanks in Advance
Upvotes: 1
Views: 697