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

Feature/deleted_changes #175

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 12 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
245 changes: 245 additions & 0 deletions app/src/main/java/app/cashadvisor/analytics/presentation/MockData.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
package app.cashadvisor.analytics.presentation

import app.cashadvisor.analytics.presentation.model.Account
import app.cashadvisor.analytics.presentation.model.AnalyticType
import app.cashadvisor.analytics.presentation.model.CategorySummary
import app.cashadvisor.analytics.presentation.model.SubcategorySummary
import app.cashadvisor.analytics.presentation.model.User
import java.math.BigDecimal
import java.util.Date

object MockData {
fun getCategorySummaryList(beginDate: Date, endDate: Date) = categorySummaryList //emptyList<CategorySummary>()//
}


val categorySummaryList :List<CategorySummary> = listOf (
// Доходы факт
CategorySummary(
id = 3,
name = "Зарплата",
analyticType = AnalyticType.INCOME,
planned = false,
amount = BigDecimal.valueOf(75000.00),
subcategoryList = listOf(
SubcategorySummary(
name = "Перевод",
amount = BigDecimal.valueOf(50000.00)
),
SubcategorySummary(
name = "Отпускные",
amount = BigDecimal.valueOf(20000.00)
),
SubcategorySummary(
name = "Премия",
amount = BigDecimal.valueOf(5000.00)
),
)
),
CategorySummary(
id = 4,
name = "Наставничество",
analyticType = AnalyticType.INCOME,
planned = false,
amount = BigDecimal.valueOf(20000.00),
subcategoryList = listOf(
SubcategorySummary(
name = "Перевод",
amount = BigDecimal.valueOf(20000.00)
),
)
),

// Расходы факт
CategorySummary(
id = 22,
name = "Еда",
analyticType = AnalyticType.EXPENSE,
planned = false,
amount = BigDecimal.valueOf(7563.00),
subcategoryList = listOf(
SubcategorySummary(
name = "Продукты",
amount = BigDecimal.valueOf(7245.00)
),
SubcategorySummary(
name = "Ресторан",
amount = BigDecimal.valueOf(318.00)
),
)
),
CategorySummary(
id = 18,
name = "Развлечения",
analyticType = AnalyticType.EXPENSE,
planned = false,
amount = BigDecimal.valueOf(533.00),
subcategoryList = listOf(
SubcategorySummary(
name = "Телеграм премиум",
amount = BigDecimal.valueOf(299.00)
),
SubcategorySummary(
name = "Яндекс плюс",
amount = BigDecimal.valueOf(199.00)
),
SubcategorySummary(
name = "Whouse",
amount = BigDecimal.valueOf(35.00)
),
)
),
// Фонд благосостояния факт
CategorySummary(
id = 25,
name = "Инвестиции",
analyticType = AnalyticType.SAVING,
planned = false,
amount = BigDecimal.valueOf(15000.00),
subcategoryList = listOf(
SubcategorySummary(
name = "Акции",
amount = BigDecimal.valueOf(10000.00)
),
SubcategorySummary(
name = "Облигации",
amount = BigDecimal.valueOf(5000.00)
),
SubcategorySummary(
name = "Даньги аыврало ыварыл фыдалфыжал фываолдыва",
Copy link

@Barsec13 Barsec13 Jul 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это ни на что не влияет?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

надо делать нормальные моки.

amount = BigDecimal.valueOf(0.00)
),
)
),
CategorySummary(
id = 2,
name = "Накопления",
analyticType = AnalyticType.SAVING,
planned = false,
amount = BigDecimal.valueOf(30000.00),
subcategoryList = listOf(
SubcategorySummary(
name = "фин подушка",
amount = BigDecimal.valueOf(25000.00)
),
SubcategorySummary(
name = "Амортизация",
amount = BigDecimal.valueOf(5000.00)
),
) // List<SubcategorySummary>
),
CategorySummary(
id = 24,
name = "Валюта",
analyticType = AnalyticType.SAVING,
planned = false,
amount = BigDecimal.valueOf(0.00),
subcategoryList = listOf(
SubcategorySummary(
name = "USD",
amount = BigDecimal.valueOf(0.00)
),
) // List<SubcategorySummary>
),
// Доходы план
CategorySummary(
id = 3,
name = "Зарплата",
analyticType = AnalyticType.INCOME,
planned = true,
amount = BigDecimal.valueOf(75000.00),
completePercent = 100.0,
subcategoryList = listOf() // List<SubcategorySummary>
),
CategorySummary(
id = 4,
name = "Наставничество",
analyticType = AnalyticType.INCOME,
planned = true,
amount = BigDecimal.valueOf(25000.00),
completePercent = 80.0,
subcategoryList = listOf() // List<SubcategorySummary>
),

// Расходы план
CategorySummary(
id = 22,
name = "Еда",
analyticType = AnalyticType.EXPENSE,
planned = true,
amount = BigDecimal.valueOf(20000.00),
completePercent = 80.0,
subcategoryList = listOf() // List<SubcategorySummary>
),
CategorySummary(
id = 17,
name = "Техника",
analyticType = AnalyticType.EXPENSE,
planned = true,
amount = BigDecimal.valueOf(10000.00),
completePercent = 00.0,
subcategoryList = listOf() // List<SubcategorySummary>
),
CategorySummary(
id = 18,
name = "Развлечения",
analyticType = AnalyticType.EXPENSE,
planned = true,
amount = BigDecimal.valueOf(10000.00),
completePercent = 10.0,
subcategoryList = listOf() // List<SubcategorySummary>
),
CategorySummary(
id = 12,
name = "Транспорт",
analyticType = AnalyticType.EXPENSE,
planned = true,
amount = BigDecimal.valueOf(5000.00),
completePercent = 0.0,
subcategoryList = listOf() // List<SubcategorySummary>
),
CategorySummary(
id = 19,
name = "Прочее",
analyticType = AnalyticType.EXPENSE,
planned = true,
amount = BigDecimal.valueOf(5000.00),
completePercent = 0.0,
subcategoryList = listOf() // List<SubcategorySummary>
),
// Фонд благосостояния план
/* CategorySummary(
id = 25,
name = "Инвестиции",
analyticType = AnalyticType.SAVING,
planned = true,
amount = BigDecimal.valueOf(15000.00),
subcategoryList = listOf() // List<SubcategorySummary>
),
CategorySummary(
id = 2,
name = "Накопления",
analyticType = AnalyticType.SAVING,
planned = true,
amount = BigDecimal.valueOf(30000.00),
subcategoryList = listOf() // List<SubcategorySummary>
),
CategorySummary(
id = 24,
name = "Валюта",
analyticType = AnalyticType.SAVING,
planned = true,
amount = BigDecimal.valueOf(0.00),
subcategoryList = listOf() // List<SubcategorySummary>
),*/
)

val account = Account(
amount = BigDecimal.valueOf(8600000.00)
)

val user = User(
id = 100,
name = "Андрей",
lastName = "Иванов"
)
28 changes: 28 additions & 0 deletions app/src/main/java/app/cashadvisor/analytics/presentation/Utils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package app.cashadvisor.analytics.presentation

import java.math.BigDecimal
import java.text.NumberFormat
import java.util.Calendar
import java.util.Date

fun Date.getLastDayOfMonth() : Date {
avanisimov marked this conversation as resolved.
Show resolved Hide resolved
val current = Calendar.getInstance()
val lastDay = Calendar.getInstance()
lastDay.set(current.get(Calendar.YEAR), current.get(Calendar.MONTH),
current.getActualMaximum(Calendar.DATE))
return lastDay.time
}

fun Date.getFirstDayOfMonth() : Date {
val current = Calendar.getInstance()
val firstDay = Calendar.getInstance()
firstDay.set(current.get(Calendar.YEAR), current.get(Calendar.MONTH), 1)
return firstDay.time
}

fun BigDecimal.formatAmount() : String {
avanisimov marked this conversation as resolved.
Show resolved Hide resolved
val formatter = NumberFormat.getNumberInstance()
formatter.minimumFractionDigits = 2
formatter.maximumFractionDigits = 2
return formatter.format(this)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app.cashadvisor.analytics.presentation.model

import java.math.BigDecimal

data class Account(
val amount: BigDecimal,
val currency: String? = null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package app.cashadvisor.analytics.presentation.model

enum class AnalyticType(val value: Int) {
INCOME(0),
EXPENSE(1),
SAVING(2);

companion object {
fun of(value: Int): AnalyticType {
return when (value) {
0 -> INCOME
1 -> EXPENSE
else -> SAVING
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package app.cashadvisor.analytics.presentation.model

import java.math.BigDecimal

data class CategorySummary(
val id: Long,
val name: String,
val analyticType: AnalyticType,
val planned: Boolean,
val amount: BigDecimal,
val completePercent: Double? = null,
val subcategoryList: List<SubcategorySummary>?,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package app.cashadvisor.analytics.presentation.model

import app.cashadvisor.analytics.presentation.getFirstDayOfMonth
import app.cashadvisor.analytics.presentation.getLastDayOfMonth
import java.util.Date

data class FilterParams(
val beginDate: Date,
val endDate: Date,
val analyticType: AnalyticType,
val planned: Boolean
) {

companion object {
fun getDefault(): FilterParams {
return FilterParams(
beginDate = Date().getFirstDayOfMonth(),
endDate = Date().getLastDayOfMonth(),
analyticType = AnalyticType.INCOME,
planned = false)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app.cashadvisor.analytics.presentation.model

import java.math.BigDecimal

data class SubcategorySummary(
val name: String,
val amount: BigDecimal,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app.cashadvisor.analytics.presentation.model

data class User(
val id: Long,
val name: String,
val lastName: String,
val avatarUrl: String? = null,
)
Loading