moved func to utils

This commit is contained in:
2024-09-15 16:03:10 +02:00
parent e8bd840797
commit 906403f752
3 changed files with 8 additions and 15 deletions

View File

@@ -5,6 +5,7 @@ import { ThemeButton, ThemeText } from '../common/ThemeTypes';
import { Picker } from '@react-native-picker/picker';
import { FontAwesome } from '@expo/vector-icons';
import { Colors } from 'react-native/Libraries/NewAppScreen';
import { getDefaultFilter } from '../utils/getDefaultFilter';
const categories = { class: 'Klasse', room: 'Raum', teacher: 'Lehrer' };
@@ -143,12 +144,4 @@ return (
);
};
const getDefaultFilter = (userInformation) => {
if (!userInformation) return null;
let type = userInformation.usertype == 'pupil' ? 'class' : 'teacher';
let value = userInformation.usertype == 'pupil' ? userInformation.classid : userInformation.id;
return { type: type, value: value, group: String(userInformation.group) };
};
export default FilterModal;

View File

@@ -13,6 +13,7 @@ import { ThemeButton, ThemeText } from '../common/ThemeTypes';
import { useColors } from '../common/colors';
import { AntDesign } from '@expo/vector-icons';
import FilterModal from '../common/FilterModal';
import { getDefaultFilter } from '../utils/getDefaultFilter';
let errorObject;
let categories = { class: 'Klasse', room: 'Raum', teacher: 'Lehrer' };
@@ -124,10 +125,3 @@ const Schedule = () => {
};
export default Schedule;
const getDefaultFilter = (userInformation) => {
if (!userInformation) return null
let type = userInformation.usertype == 'pupil' ? 'class' : 'teacher';
let value = userInformation.usertype == 'pupil' ? userInformation.classid : userInformation.id;
return { type: type, value: value, group: String(userInformation.group) }
}

View File

@@ -0,0 +1,6 @@
export const getDefaultFilter = (userInformation) => {
if (!userInformation) return null;
let type = userInformation.usertype == 'pupil' ? 'class' : 'teacher';
let value = userInformation.usertype == 'pupil' ? userInformation.classid : userInformation.id;
return { type: type, value: value, group: String(userInformation.group) };
};