Skip to content

Commit

Permalink
can officially post sublet!!
Browse files Browse the repository at this point in the history
  • Loading branch information
vavali08 committed Feb 2, 2024
1 parent 6343d2d commit d9ff672
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,23 +208,34 @@ class NewListingsFragment(private val dataModel: SublettingViewModel) : Fragment
private fun postSublet(title : String, price : Int, address : String?, startDate: String,
endDate : String, beds: Int?, baths: Int?, amenities: List<String>?,
description: String?) {
val convertedEnd = convertToYYYYMMDD(endDate)
val convertedStart = convertToYYYYMMDD(startDate)


val newSublet = Sublet(
endDate = "2023-12-05",
endDate = convertedEnd,
baths = baths,
address = address,
maxPrice = price,//fix
expiresAt = "3000-02-01T10:48:02-05:00",
expiresAt = "3000-02-01T10:48:02-05:00", //?
minPrice = 0, // fix
description = description,
title = title,
beds = beds,
externalLink = "https://pennlabs.org/", // fix
startDate = "2023-04-04"
startDate = convertedStart
)

dataModel.postSublet(mActivity, newSublet)
}

private fun convertToYYYYMMDD(mmddyy: String): String {
val components = mmddyy.split("/")
val month = components[0].toInt()
val day = components[1].toInt()
val year = components[2].toInt() + 2000

return String.format("%04d-%02d-%02d", year, month, day)
}

}

0 comments on commit d9ff672

Please sign in to comment.