Я профукал провод, комичу все с пк на ноут, чтобы подключиться
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
|
@Composable
|
||||||
fun TableScreen(reportData: List<ReportRemote>) {
|
fun TableScreen(reportData: List<ReportRemote>) {
|
||||||
|
|
||||||
|
@ -16,13 +16,22 @@
|
|||||||
"rents": [],
|
"rents": [],
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"dateTime": 2009,
|
"dateTime": 2015,
|
||||||
"weight": 36.6,
|
"weight": 36.6,
|
||||||
"radius": 14.5,
|
"radius": 14.5,
|
||||||
"colorbike": "Красный",
|
"colorbike": "Красный",
|
||||||
"maxCount": 10,
|
"maxCount": 10,
|
||||||
"bikeId": 3,
|
"bikeId": 3,
|
||||||
"id": 1
|
"id": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"dateTime": 2009,
|
||||||
|
"weight": 29.6,
|
||||||
|
"radius": 13.5,
|
||||||
|
"colorbike": "Зеленый",
|
||||||
|
"maxCount": 5,
|
||||||
|
"bikeId": 3,
|
||||||
|
"id": 2
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bikes": [
|
"bikes": [
|
||||||
|
@ -20,8 +20,8 @@ module.exports = (req, res, next) => {
|
|||||||
const toDate = req.query.toDate;
|
const toDate = req.query.toDate;
|
||||||
const filteredData = filterByDateTime(data.items, fromDate, 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);
|
res.json(reportData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading data:', error);
|
console.error('Error loading data:', error);
|
||||||
@ -33,7 +33,7 @@ module.exports = (req, res, next) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Функция generateReport для примера
|
// Функция generateReport для примера
|
||||||
function generateReport(items) {
|
function generateReport(items, bikes) {
|
||||||
// Ваш код для генерации отчета
|
// Ваш код для генерации отчета
|
||||||
return items.map((item) => ({
|
return items.map((item) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@ -42,7 +42,7 @@ function generateReport(items) {
|
|||||||
radius: item.radius,
|
radius: item.radius,
|
||||||
colorbike: item.colorbike,
|
colorbike: item.colorbike,
|
||||||
maxCount: item.maxCount,
|
maxCount: item.maxCount,
|
||||||
bikeId: item.bikeId
|
bikeName: bikes.find((bike) => bike.id === item.bikeId)?.name,
|
||||||
|
|
||||||
// Другие поля отчета, которые вам нужны
|
// Другие поля отчета, которые вам нужны
|
||||||
}));
|
}));
|
||||||
|
Loading…
Reference in New Issue
Block a user