Skip to content

Commit

Permalink
Merge pull request #57 from yl-ang/clean-files
Browse files Browse the repository at this point in the history
Clean files  & integrate
  • Loading branch information
yl-ang authored Jun 14, 2022
2 parents 2137524 + 07f2a3c commit 7aa35c7
Show file tree
Hide file tree
Showing 9 changed files with 7,141 additions and 7,012 deletions.
40 changes: 0 additions & 40 deletions database.js

This file was deleted.

4 changes: 2 additions & 2 deletions firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export function updateRunning(running_time) {
)
}

export function updateIpptScore(ipptScore) {
updateDoc(doc(db, "users", auth.currentUser.uid),
export async function updateIpptScore(ipptScore) {
await updateDoc(doc(db, "users", auth.currentUser.uid),
{
Ippt_Score: ipptScore
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/compenents/ippt.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const calculateIppt = (age, pushUpCount, sitUpCount, runTime) => {

const ipptPoints = pushUpScore + sitUpScore + runScore;

console.log("wh" + ipptPoints);

return ipptPoints;
};

Expand Down
1 change: 1 addition & 0 deletions frontend/screens/homePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default HomePage = () => {
navigation.navigate("Login");
}


useFocusEffect(

useCallback(() => {
Expand Down
21 changes: 18 additions & 3 deletions frontend/screens/ipptSubmissionPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState, useEffect, useCallback } from 'react';
import {useTailwind} from 'tailwind-rn';
import { useFocusEffect } from "@react-navigation/native";
import { Button, List, ListItem, Layout, Input, Text, Divider, Spinner } from '@ui-kitten/components';
import { setNestedObjectValues, useFormik } from "formik";
import { Alert, Keyboard, TouchableWithoutFeedback, Image, View } from "react-native";
Expand All @@ -10,6 +11,7 @@ import { MaterialCommunityIcons, FontAwesome5 } from '@expo/vector-icons';
import { useNavigation } from "@react-navigation/native";
import { ipptSchema } from "./validationSchema.js"
import { calculateIppt } from '../compenents/ippt.js';
import { updateIpptScore } from '../../firebase.js';

export default SubmitIpptPage = () => {
const tailwind = useTailwind();
Expand All @@ -30,6 +32,9 @@ export default SubmitIpptPage = () => {

onSubmit: () => {
//TODO: upload data to database
const runTime =
parseInt(values.runningMin) * 60 +
parseInt(values.runningSec);
formSubmissionVerification()
},

Expand All @@ -51,10 +56,20 @@ export default SubmitIpptPage = () => {
parseInt(values.runningMin) * 60 +
parseInt(values.runningSec);

const ipptPoints = calculateIppt(21, parseInt(values.pushup), parseInt(values.situp), runTime)
var ipptPoints = -1;

console.log("Received pushups: " + values.pushup);
console.log("Received situp: " + values.situp);
console.log("Received runTime: " + runTime);



ipptPoints = calculateIppt(25, parseInt(values.pushup), parseInt(values.situp), runTime, 'male');

// update ipptPoints
setValues({ ...values, ipptPoints})
console.log("This is the ippt score: " + values.ipptPoints)
console.log("This is the ippt score: " + values.ipptPoints);
updateIpptScore(values.ipptPoints);
}

const formSubmissionVerification = () => {
Expand All @@ -65,7 +80,7 @@ export default SubmitIpptPage = () => {
[
{
text: "Confirm",
onPress: () => {console.log("Submitting to database!!"), getIpptScore(), handleNavigation()},
onPress: () => {console.log("Submitting to database!!"), getIpptScore(), updateIpptScore(values.ipptPoints), handleNavigation()},
},
{
text: "Cancel",
Expand Down
2 changes: 1 addition & 1 deletion frontend/screens/registrationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default RegistrationPage = () => {
[
{
text: "Confirm",
onPress: () => {handleSignUp},
onPress: () => {handleSignUp()},
},
{
text: "Cancel",
Expand Down
25 changes: 25 additions & 0 deletions tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@

.top-1 {
top: 0.25rem

}

.left-3 {
left: 0.75rem
}

.left-4 {
left: 1rem

}

.left-3 {
Expand Down Expand Up @@ -86,6 +96,18 @@
right: 4rem
}


.top-9 {
top: 2.25rem
}

.top-2 {
top: 0.5rem
}

.bottom-1 {
bottom: 0.25rem

.right-32 {
right: 8rem
}
Expand All @@ -96,6 +118,7 @@

.right-2 {
right: 0.5rem

}

.mx-40 {
Expand Down Expand Up @@ -307,6 +330,8 @@
padding: 1rem
}



.text-left {
text-align: left
}
Expand Down
8 changes: 8 additions & 0 deletions tailwind.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
}
},
"top-2": {

"style": {
"top": 8
}
},
"bottom-1": {
"style": {
"top": 8
}
Expand Down Expand Up @@ -414,6 +420,7 @@
"paddingLeft": 16
}
},
"text-center": {
"text-left": {
"style": {
"textAlign": "left"
Expand All @@ -425,6 +432,7 @@
}
},
"text-start": {

"style": {
"textAlign": "start"
}
Expand Down
Loading

0 comments on commit 7aa35c7

Please sign in to comment.