Skip to content

Commit

Permalink
Update ARB + Biotech durations
Browse files Browse the repository at this point in the history
Updated ARB durations to range from 30 minutes to 90 minutes; biotech  from 30 minutes to three hours
  • Loading branch information
vavali08 committed Oct 1, 2023
1 parent 3e9aecc commit a680bce
Showing 1 changed file with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class GsrFragment : Fragment() {
private val gsrSlotFormatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZZ")

private lateinit var durationAdapter: ArrayAdapter<String>
private lateinit var huntsmanDurationAdapter: ArrayAdapter<String>
private lateinit var whartonDurationAdapter: ArrayAdapter<String>
private lateinit var biotechDurationAdapter: ArrayAdapter<String>

private var populatedDropDownGSR = false

Expand Down Expand Up @@ -98,7 +99,8 @@ class GsrFragment : Fragment() {
noResultsPanel = view.gsr_no_results

durationAdapter = ArrayAdapter(mActivity, R.layout.gsr_spinner_item, arrayOf("30m", "60m", "90m", "120m"))
huntsmanDurationAdapter = ArrayAdapter(mActivity, R.layout.gsr_spinner_item, arrayOf("30m", "60m", "90m"))
whartonDurationAdapter = ArrayAdapter(mActivity, R.layout.gsr_spinner_item, arrayOf("30m", "60m", "90m"))
biotechDurationAdapter = ArrayAdapter(mActivity, R.layout.gsr_spinner_item, arrayOf("30m", "60m", "90m", "120m", "150m", "180m"))

// update user status by getting the bearer token and checking wharton status
updateStatus()
Expand Down Expand Up @@ -409,8 +411,10 @@ class GsrFragment : Fragment() {
val adapter = ArrayAdapter(activity, R.layout.gsr_spinner_item, gsrs)
gsrLocationDropDown.adapter = adapter

durationDropDown.adapter = if (gsrLocationDropDown.selectedItem.toString() == "Huntsman")
huntsmanDurationAdapter else durationAdapter
durationDropDown.adapter = if (gsrLocationDropDown.selectedItem.toString() == "Huntsman"
|| gsrLocationDropDown.selectedItem.toString() == "Academic Research")
whartonDurationAdapter else if (gsrLocationDropDown.selectedItem.toString() == "Biomedical")
biotechDurationAdapter else durationAdapter
searchForGSR(false)
}
}
Expand All @@ -423,7 +427,7 @@ class GsrFragment : Fragment() {
gsrHashMap["Weigle"] = "1086"
gsrHashMap["Lippincott"] = "2587"
gsrHashMap["Edu Commons"] = "2495"
gsrHashMap["Biomedical"] = "2683"
gsrHashMap["Biotech Commons"] = "2683"
gsrHashMap["Fisher"] = "2637"
gsrHashMap["Levin Building"] = "1090"
gsrHashMap["Museum Library"] = "2634"
Expand All @@ -437,8 +441,10 @@ class GsrFragment : Fragment() {
val adapter = ArrayAdapter(activity, R.layout.gsr_spinner_item, gsrs)
gsrLocationDropDown.adapter = adapter

durationDropDown.adapter = if (gsrLocationDropDown.selectedItem.toString() == "Huntsman")
huntsmanDurationAdapter else durationAdapter
durationDropDown.adapter = if (gsrLocationDropDown.selectedItem.toString() == "Huntsman"
|| gsrLocationDropDown.selectedItem.toString() == "Academic Research")
whartonDurationAdapter else if (gsrLocationDropDown.selectedItem.toString() == "Biotech Commons")
biotechDurationAdapter else durationAdapter
searchForGSR(false)
}
}
Expand All @@ -448,11 +454,16 @@ class GsrFragment : Fragment() {
override fun onItemSelected(adapterView: AdapterView<*>, view: View?, i: Int, l: Long) {
// change possible durations depending on the location
var durationPos = durationDropDown.selectedItemPosition
if (durationPos == 3 && gsrLocationDropDown.selectedItem.toString() == "Huntsman") {
if (durationPos >= 3 && (gsrLocationDropDown.selectedItem.toString() == "Huntsman"
|| gsrLocationDropDown.selectedItem.toString() == "Academic Research")) {
durationPos = 2
} else if (durationPos > 3 && gsrLocationDropDown.selectedItem.toString() != "Biotech Commons") {
durationPos = 3
}
durationDropDown.adapter = if (gsrLocationDropDown.selectedItem.toString() == "Huntsman")
huntsmanDurationAdapter else durationAdapter
durationDropDown.adapter = if (gsrLocationDropDown.selectedItem.toString() == "Huntsman"
|| gsrLocationDropDown.selectedItem.toString() == "Academic Research")
whartonDurationAdapter else if (gsrLocationDropDown.selectedItem.toString() == "Biotech Commons")
biotechDurationAdapter else durationAdapter
durationDropDown.setSelection(durationPos)
searchForGSR(false)
}
Expand Down

0 comments on commit a680bce

Please sign in to comment.