mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2025-05-17 03:48:06 +08:00
Added student status point rendering
This commit is contained in:
parent
00928ac947
commit
980d1e636e
3 changed files with 97 additions and 6 deletions
|
@ -0,0 +1,35 @@
|
|||
import * as React from "react";
|
||||
import { View, Text } from "react-native";
|
||||
import {
|
||||
StudentStatusFilterType,
|
||||
LocationType,
|
||||
subjectUserMapType,
|
||||
StudentStatusListType,
|
||||
StudentStatusFilterTypeFlattened,
|
||||
} from "../../interfaces/Interfaces";
|
||||
import { Double, Float } from "react-native/Libraries/Types/CodegenTypes";
|
||||
|
||||
export default function ParseStudentStatusList(data: any) {
|
||||
// Individual map point generation for student statuses
|
||||
// Include only those that do not have study groups
|
||||
// Then we simply flatten the data. Much simpler compared to study groups
|
||||
let data_filtered = data.filter(
|
||||
(item: StudentStatusFilterType) => item.study_group == ""
|
||||
);
|
||||
console.log("Filtered Data:", data_filtered);
|
||||
// Then we flatten the data so that all attributes are in the first layer
|
||||
// We first flatten the data to remove nested entries
|
||||
let data_flattened = data_filtered.map((item: StudentStatusFilterType) => ({
|
||||
active: item.active,
|
||||
distance: item.distance,
|
||||
landmark: item.landmark,
|
||||
latitude: item.location.latitude,
|
||||
longitude: item.location.longitude,
|
||||
study_group: item.study_group,
|
||||
subject: item.subject,
|
||||
user: item.user,
|
||||
weight: 1,
|
||||
}));
|
||||
|
||||
return data_flattened;
|
||||
}
|
|
@ -132,12 +132,12 @@ export default function ParseStudyGroupList(
|
|||
user_location.longitude
|
||||
);
|
||||
|
||||
console.log(
|
||||
/*console.log(
|
||||
"Haversine Distance for entry #",
|
||||
index + 1,
|
||||
":",
|
||||
distance
|
||||
);
|
||||
);*/
|
||||
return distance;
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue