Skip to content

Commit

Permalink
Error Handling + Helper Text (#94)
Browse files Browse the repository at this point in the history
* Added handling for non numbers and empty values

* Added comments for future work

* Frankreed/unify result screens (#96)

* Result screens unified!

* fixed the display bug in result

* added title to styles, some redundancy removed from barChartScreen

---------

Co-authored-by: Jake Gehrke <gehrkej@oregonstate.edu>

* Planscreen player (#131)

* plan hooked fully to database and finished by submitting drill

* scroll down to refresh

* change naming to be more clear and requre drill id and assigned_time

* add assigned_data to user on user creation

* fix key issue, lighter green, squircle, spacing of description

* styling

* updated prettier and github action settings to be more strict

* code cleanup

* ran pretty

* attemptRefId into attemptId

---------

Co-authored-by: Frankreed <baoanhtdn@gmail.com>

* added hard coded helper text

* helperText is now pulled from database

* Added handling for non numbers and empty values

* Added comments for future work

* added hard coded helper text

* helperText is now pulled from database

* added error handling for submit drill button

* adjusted uploadAttempt function after rebase

* updated SID to be 1-20

* added error handling for submit drill button

* adjusted uploadAttempt function after rebase

* updated SID to be 1-20

* Inital changes requested from frank in PR

* Converted error banners to error dialogs

* Frankreed/Bar chart is 60fps consistent now (#129)

* Database updated and codebase uses title instead of drillType

* Removed title and added prettyDrillType and subType

* Added putting to database and updated codebase

* Rebased with layout and prettiier ran

* leaderboard is more resilient to incorrect data

* style changes

* barChart performance vastly improved. Frame rate is now pegged at 60 (for ios). Still crashes on Android.

* this doesn't improve anything measurable, it just makes sense in my head

* Paginate barChart

* very minor tick change/add back

* barChart now displays 0 as the minimum instead of the lowest value (if the lowest value is lower than 0, display that instead).
Illegal attempts shall be terminated

---------

Co-authored-by: hannacol <hannacol@oregonstate.edu>

* Minor cosmetic fixes (#138)

* Database updated and codebase uses title instead of drillType

* Removed title and added prettyDrillType and subType

* Added putting to database and updated codebase

* Rebased with layout and prettiier ran

* made target an array for all drill types for consistency and fixed shotAccordion shotNum display

* updated more code for target lists

* Result screen works for putting drills

* style changes

* Ran prettier

* Updated Headers to hold title better

* prettier ran

* ran prettier

* added margin to the left and right of the segmented buttons

* commented out a lot of prints, changed uid to a string instead of reference,
sorted user in Teams based on role

* Fixed shotAccordion's weird shot spacing

---------

Co-authored-by: hannacol <hannacol@oregonstate.edu>

* Database updated and codebase uses title instead of drillType (#134)

* Database updated and codebase uses title instead of drillType

* Removed title and added prettyDrillType and subType

* Added putting to database and updated codebase

* Rebased with layout and prettiier ran

* made target an array for all drill types for consistency and fixed shotAccordion shotNum display

* Result screen works for putting drills

* style changes

* ran prettier

* Made attemptShots use an object instead of an array for targets and componentized header

* Fixed drill list styling and ran prettier after rebase

---------

Co-authored-by: Frankreed <baoanhtdn@gmail.com>

* Reworking Drill Screens to be Componentized (#140)

* DrillList has been componentized for main drill list and profile view to be sectioned off

* Moved glyphs to be in section header instead of drill card

* Drlll Description componentized for description screen and description modal and deleted image carousel

* ran yarn pretty

* slight optimization to getUnique

* Removed prettyDrillType and modified drillType

---------

Co-authored-by: Frankreed <baoanhtdn@gmail.com>

* ErrorDialog Component Created and Styled

* Added styling to Leave Dialog

* Swapped order of action buttons in leave drill dialog

* Created submitVisable varible

* Added handling for non numbers and empty values

* Added comments for future work

* added hard coded helper text

* helperText is now pulled from database

* added error handling for submit drill button

* adjusted uploadAttempt function after rebase

* updated SID to be 1-20

* Added handling for non numbers and empty values

* added error handling for submit drill button

* Inital changes requested from frank in PR

* Converted error banners to error dialogs

* ErrorDialog Component Created and Styled

* Added styling to Leave Dialog

* Swapped order of action buttons in leave drill dialog

* Created submitVisable varible

* added header import back

* fix weird stuff with rebase

* more weird rebase things

* Restart Drill functionality working (#136)

* fixed duplicate sid

* All dialogs using DialogComponent

* Added handling for non numbers and empty values

* Added comments for future work

* added hard coded helper text

* helperText is now pulled from database

* added error handling for submit drill button

* adjusted uploadAttempt function after rebase

* updated SID to be 1-20

* Added handling for non numbers and empty values

* added error handling for submit drill button

* Inital changes requested from frank in PR

* Converted error banners to error dialogs

* ErrorDialog Component Created and Styled

* Added styling to Leave Dialog

* Swapped order of action buttons in leave drill dialog

* Created submitVisable varible

* added header import back

* Added handling for non numbers and empty values

* Added comments for future work

* adjusted uploadAttempt function after rebase

* Added handling for non numbers and empty values

* ErrorDialog Component Created and Styled

* All dialogs using DialogComponent

* Fixed uploadAttempt header comment

* changed == to ===, and added one missing import, remove unused imports, and fixed calculateProxHole cuz I was stupid...

* fixed faulty getUnique

---------

Co-authored-by: Frank Nguyen <41023671+FrankreedX@users.noreply.github.com>
Co-authored-by: ajpert <84763013+ajpert@users.noreply.github.com>
Co-authored-by: Frankreed <baoanhtdn@gmail.com>
Co-authored-by: hannacol <hannacol@oregonstate.edu>
Co-authored-by: hannacol <91215417+hannacol@users.noreply.github.com>
  • Loading branch information
6 people committed Apr 12, 2024
1 parent 21eafc0 commit 5429ddb
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 101 deletions.
4 changes: 2 additions & 2 deletions Utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ export function numTrunc(value, pad = false) {
}
}

export function getUnique(array, field, drills) {
export function getUnique(array, drills) {
const unique = [];
drills.forEach((drillInfo) => {
const idx = array.findIndex((item) => item["did"] === drillInfo["did"]);
if (idx >= 0) unique.push(drills[idx]);
if (idx >= 0) unique.push(drillInfo);
});
return unique;
}
Expand Down
26 changes: 14 additions & 12 deletions app/content/profile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,10 @@ import {
TouchableOpacity,
View,
} from "react-native";
import {
Appbar,
Button,
Dialog,
PaperProvider,
Paragraph,
Portal,
Snackbar,
} from "react-native-paper";
import { Appbar, PaperProvider, Snackbar } from "react-native-paper";
import { SafeAreaView } from "react-native-safe-area-context";
import { getUnique } from "~/Utility";
import DialogComponent from "~/components/dialog";
import DrillList from "~/components/drillList";
import ErrorComponent from "~/components/errorComponent";
import Loading from "~/components/loading";
Expand Down Expand Up @@ -207,7 +200,7 @@ function Index(props) {
}
};

const uniqueDrills = getUnique(attempts, "did", Object.values(drillInfo));
const uniqueDrills = getUnique(attempts, Object.values(drillInfo));

return (
<PaperProvider>
Expand All @@ -219,7 +212,7 @@ function Index(props) {
{snackbarMessage}
</Snackbar>

<Portal>
{/* <Portal>
<Dialog
visible={dialogVisible}
onDismiss={() => setDialogVisible(false)}
Expand All @@ -232,7 +225,16 @@ function Index(props) {
<Button onPress={() => setDialogVisible(false)}>OK</Button>
</Dialog.Actions>
</Dialog>
</Portal>
</Portal> */}

<DialogComponent
title={dialogTitle}
content={dialogMessage}
visible={dialogVisible}
onHide={() => setDialogVisible(false)}
buttons={["OK"]}
buttonsFunctions={[() => setDialogVisible(false)]}
/>

<SafeAreaView style={{ flex: 1 }}>
<Appbar.Header statusBarHeight={0} style={{ backgroundColor: "FFF" }}>
Expand Down
2 changes: 1 addition & 1 deletion app/content/team/users/[user]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Index(props) {
);
}

const uniqueDrills = getUnique(attempts, "did", Object.values(drillInfo));
const uniqueDrills = getUnique(attempts, Object.values(drillInfo));

return (
<PaperProvider>
Expand Down
5 changes: 3 additions & 2 deletions app/segments/drill/[id]/submission/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import Loading from "~/components/loading";
import Input from "./input";
import Result from "./result";

import ErrorComponent from "~/components/errorComponent";
import { useDrillInfo } from "~/hooks/useDrillInfo";

export default function Index() {
const { id, assignedTime } = useLocalSearchParams();
const { id } = useLocalSearchParams();

const [outputData, setOutputData] = useState([]);
const [toggleResult, setToggleResult] = useState(false);
Expand All @@ -25,7 +26,7 @@ export default function Index() {
if (drillInfoError) return <ErrorComponent error={drillInfoError.message} />;

const display = () => {
if (toggleResult == true) {
if (toggleResult) {
return (
<Result
submission={outputData}
Expand Down
Loading

0 comments on commit 5429ddb

Please sign in to comment.