Я профукал провод, комичу все с пк на ноут, чтобы подключиться
This commit is contained in:
parent
529af56d53
commit
e1f83a204a
@ -273,17 +273,6 @@ fun ReportPage (navController: NavController?, viewModel: ReportViewModel = view
|
||||
}
|
||||
}
|
||||
|
||||
private fun parseDate(dateString: String): Date? {
|
||||
return try {
|
||||
// Use SimpleDateFormat or any other method to parse the string into a Date object
|
||||
// For example:
|
||||
SimpleDateFormat("yyyy", Locale.getDefault()).parse(dateString)
|
||||
} catch (e: ParseException) {
|
||||
// Handle parsing error
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun TableScreen(reportData: List<ReportRemote>) {
|
||||
|
||||
|
@ -16,13 +16,22 @@
|
||||
"rents": [],
|
||||
"items": [
|
||||
{
|
||||
"dateTime": 2009,
|
||||
"dateTime": 2015,
|
||||
"weight": 36.6,
|
||||
"radius": 14.5,
|
||||
"colorbike": "Красный",
|
||||
"maxCount": 10,
|
||||
"bikeId": 3,
|
||||
"id": 1
|
||||
},
|
||||
{
|
||||
"dateTime": 2009,
|
||||
"weight": 29.6,
|
||||
"radius": 13.5,
|
||||
"colorbike": "Зеленый",
|
||||
"maxCount": 5,
|
||||
"bikeId": 3,
|
||||
"id": 2
|
||||
}
|
||||
],
|
||||
"bikes": [
|
||||
|
@ -20,8 +20,8 @@ module.exports = (req, res, next) => {
|
||||
const toDate = req.query.toDate;
|
||||
const filteredData = filterByDateTime(data.items, fromDate, toDate);
|
||||
|
||||
// Возвращаем отфильтрованные элементы
|
||||
const reportData = generateReport(filteredData);
|
||||
// Возвращаем отфильтрованные и отсортированные элементы
|
||||
const reportData = generateReport(filteredData, data.bikes).sort((a, b) => a.dateTime - b.dateTime);
|
||||
res.json(reportData);
|
||||
} catch (error) {
|
||||
console.error('Error loading data:', error);
|
||||
@ -33,7 +33,7 @@ module.exports = (req, res, next) => {
|
||||
};
|
||||
|
||||
// Функция generateReport для примера
|
||||
function generateReport(items) {
|
||||
function generateReport(items, bikes) {
|
||||
// Ваш код для генерации отчета
|
||||
return items.map((item) => ({
|
||||
id: item.id,
|
||||
@ -42,7 +42,7 @@ function generateReport(items) {
|
||||
radius: item.radius,
|
||||
colorbike: item.colorbike,
|
||||
maxCount: item.maxCount,
|
||||
bikeId: item.bikeId
|
||||
bikeName: bikes.find((bike) => bike.id === item.bikeId)?.name,
|
||||
|
||||
// Другие поля отчета, которые вам нужны
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user