Skip to content

Commit

Permalink
Some changes to ingredients
Browse files Browse the repository at this point in the history
  • Loading branch information
rhit-villencr committed Feb 4, 2025
1 parent a43d97b commit d1d45c3
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CITests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
./gradlew test jacocoTestReport
- name: Upload Coverage Report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: jacoco-report
path: backend/omniplanner/build/reports/jacoco/test/html
66 changes: 66 additions & 0 deletions .idea/caches/deviceStreaming.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 25 additions & 18 deletions app/genericAddViewEventPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import DateTimePicker from '@react-native-community/datetimepicker';
import { View, Text, TextInput, ScrollView, TouchableOpacity, Modal } from 'react-native';
import { Dropdown } from 'react-native-element-dropdown';
Expand Down Expand Up @@ -77,28 +77,31 @@ const GenericAddViewPageForm: React.FC<GenericEventPageProps> = ({ title, initia
}
};

const fetchAdditionalData = async () => {
if (!fetchEndpoint) return;
try {
const token = await AsyncStorage.getItem('token');
const response = await call(`${fetchEndpoint}/${token}`, 'GET');
const formattedData = response.data.map((item: { [x: string]: any; id: any; name: any; }) => ({
value: keyValue ? item[keyValue.key] : item.id,
label: keyValue ? item[keyValue.value] : item.name,
}));
setAdditionalData(formattedData);
cLog('Fetched and formatted data:', formattedData);
} catch (error) {
console.error('Error fetching additional data:', error);
}
};

const handleChange = (name: string, value: any) => {
setFormData({ ...formData, [name]: value });
};

useFocusEffect(
useCallback(() => {
const fetchData = async () => {
cLog('Fetching additional data...');
try {
const token = await AsyncStorage.getItem('token');
const response = await call(`${fetchEndpoint}/${token}`, 'GET');

const formattedData = response.data.map((item: { [x: string]: any; id: any; name: any }) => ({
value: keyValue ? item[keyValue.key] : item.id,
label: keyValue ? item[keyValue.value] : item.name,
}));

setTimeout(() => {
setAdditionalData(formattedData);
}, 100);
cLog('Fetched and formatted data:', formattedData);
} catch (error) {
console.error('Error fetching additional data:', error);
}
};
const verifyLoginStatus = async () => {
const [isLoggedIn, token] = await AsyncStorage.multiGet(['isLoggedIn', 'token']);
if (isLoggedIn[1] === 'true' && token[1]) {
Expand All @@ -107,9 +110,13 @@ const GenericAddViewPageForm: React.FC<GenericEventPageProps> = ({ title, initia
};

verifyLoginStatus();
fetchAdditionalData();

fetchData();
}, [])
);
useEffect(() => {
cLog('Updated Additional Data:', additionalData);
}, [additionalData]);

const renderField = (field: any) => {
switch (field.type) {
Expand Down
3 changes: 2 additions & 1 deletion app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default function AuthScreen() {
iosClientId: process.env.EXPO_PUBLIC_IOS_CLIENT_ID,
androidClientId: process.env.EXPO_PUBLIC_ANDROID_CLIENT_ID,
});
// cLog("Request:", request);

useEffect(() => {
if (response?.type === 'success') {
Expand Down Expand Up @@ -113,7 +114,7 @@ export default function AuthScreen() {
<Text
style={[styles.authPageNonheaderText, { textAlign: 'left', alignSelf: 'flex-start' }]}
>
Username
Email
</Text>
<TextInput
style={styles.authPageInput}
Expand Down
2 changes: 1 addition & 1 deletion backend/.idea/dataSources.local.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified backend/omniplanner.db
Binary file not shown.

0 comments on commit d1d45c3

Please sign in to comment.