Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed point shop raffle stuff #565

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android {
applicationId "org.hackillinois.android"
minSdkVersion 23
targetSdkVersion 34
versionCode 68
versionName "2025.1.3"
versionCode 69
versionName "2025.1.4"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import java.util.*

class CountdownManager(val listener: CountDownListener) {

// 02-28-2025 : 14:30
// 02-28-2025 : 18:00
private val eventStartTime: Calendar = Calendar.getInstance().apply {
timeZone = TimeZone.getTimeZone("America/Chicago")
timeInMillis = 1740774600000 // 1708723800000
timeInMillis = 1740774600000
}

// 02-28-2025 : 18:00
Expand All @@ -19,10 +19,10 @@ class CountdownManager(val listener: CountDownListener) {
timeInMillis = 1740787200000
}

// 03-02-2025 11:30
// 03-02-2025 7:00
private val hackingEndTime: Calendar = Calendar.getInstance().apply {
timeZone = TimeZone.getTimeZone("America/Chicago")
timeInMillis = 1740936600000
timeInMillis = 1740920400000
}

private var times = listOf(eventStartTime, hackingStartTime, hackingEndTime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,14 @@ class ShopFragment : Fragment(), ShopAdapter.OnBuyItemListener {

// Called in onCreateView within shopLiveData.observe
private fun updateShopItems(newShop: List<ShopItem>) {
// Split shop items into categories
merchItems = newShop.filter { !it.isRaffle }.sortedBy { it.quantity == 0 }
raffleItems = newShop.filter { it.isRaffle }.sortedBy { it.quantity == 0 }

// **Update only the RecyclerView items**
// Update only the RecyclerView items: skip the first two fixed items for both tabs
val recyclerViewItems = if (showingMerch) {
if (merchItems.size > 2) merchItems.subList(2, merchItems.size) else listOf()
} else {
raffleItems
if (raffleItems.size > 2) raffleItems.subList(2, raffleItems.size) else listOf()
}

// Update adapter
Expand Down Expand Up @@ -336,16 +335,26 @@ class ShopFragment : Fragment(), ShopAdapter.OnBuyItemListener {
}

private fun buyFirstItem() {
if (merchItems.isNotEmpty()) {
val firstItem = merchItems[0]
val sortedItems = if (showingMerch) {
merchItems.sortedBy { it.quantity == 0 }
} else {
raffleItems.sortedBy { it.quantity == 0 }
}
if (sortedItems.isNotEmpty()) {
val firstItem = sortedItems[0]
Log.d("ShopFragment", "Buying: ${firstItem.name}")
onBuyItem(firstItem)
}
}

private fun buySecondItem() {
if (merchItems.size >= 2) {
val secondItem = merchItems[1]
val sortedItems = if (showingMerch) {
merchItems.sortedBy { it.quantity == 0 }
} else {
raffleItems.sortedBy { it.quantity == 0 }
}
if (sortedItems.size >= 2) {
val secondItem = sortedItems[1]
Log.d("ShopFragment", "Buying: ${secondItem.name}")
onBuyItem(secondItem)
}
Expand Down