Skip to content

Commit

Permalink
Fixed assignment not complete-able (#328)
Browse files Browse the repository at this point in the history
* changed dialog component to new inputs

* keyboard avoiding in input is now a lot smoother

* added mergeTime in addition to assignedTime to make clear which one is rounded
  • Loading branch information
FrankreedX authored Aug 20, 2024
1 parent d65f72c commit 0878f5a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
14 changes: 7 additions & 7 deletions app/content/assignments/players.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { db } from "~/firebaseConfig";

function Index() {
const navigation = useNavigation();
const { drillId, assignedTime } = useLocalSearchParams();
const { drillId, mergeTime } = useLocalSearchParams();
const {
data: drillInfo,
isLoading: drillInfoIsLoading,
Expand Down Expand Up @@ -58,7 +58,7 @@ function Index() {
getLocalizedDate({
time: assignment.assignedTime,
rounded: true,
}).getTime() == assignedTime && assignment.drillId === drillId;
}).getTime() == mergeTime && assignment.drillId === drillId;
setAssignmentList(
Object.values(userInfo)
.filter((user) => user.assigned_data.some(critera))
Expand All @@ -79,7 +79,7 @@ function Index() {
}, [
userInfo,
getLocalizedDate,
assignedTime,
mergeTime,
drillId,
assignmentList.length,
navigation,
Expand Down Expand Up @@ -122,10 +122,10 @@ function Index() {
getLocalizedDate({
time: assignment.assignedTime,
rounded: true,
}).getTime() != assignedTime,
}).getTime() != mergeTime,
);
console.log("Updated Assignment List: ", updatedAssignmentList);
console.log("current assignedTime: ", assignedTime);
console.log("current mergeTime: ", mergeTime);
playerList.push({
uid: assignment.uid,
assigned_data: updatedAssignmentList,
Expand Down Expand Up @@ -156,7 +156,7 @@ function Index() {
}
}),
[
assignedTime,
mergeTime,
assignmentList,
currentTeamId,
getLocalizedDate,
Expand Down Expand Up @@ -200,7 +200,7 @@ function Index() {
if (docSnap.exists()) {
const assignedData = docSnap.data().assigned_data;
const updatedAssignedData = assignedData.map((a) => {
if (a.assignedTime == assignedTime && a.drillId === drillId) {
if (a.assignedTime == mergeTime && a.drillId === drillId) {
return { ...a, completed: false };
}
return a;
Expand Down
2 changes: 2 additions & 0 deletions app/segments/drill/[id]/submission/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ async function completeAssigned(

if (docSnap.exists()) {
const assignedData = docSnap.data()["assigned_data"];
console.log("assignedData", assignedData);
console.log("assignedTime", assignedTime);
const updatedAssignedData = assignedData.map((assignment) => {
if (
assignment.assignedTime == assignedTime &&
Expand Down
11 changes: 6 additions & 5 deletions components/assignmentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const AssignmentsList = ({

if (!alreadyAddedData[mergeTime][drillId]) {
alreadyAddedData[mergeTime][drillId] = {
assignedTime: mergeTime,
assignedTime,
mergeTime,
drillId,
players: [],
};
Expand All @@ -70,7 +71,7 @@ const AssignmentsList = ({
// Group the assigned drills by date
const groupedData = useMemo(() => {
return assigned_data.reduce((acc, curr) => {
const time = curr.assignedTime;
const time = curr.mergeTime;

if (!acc[time]) {
acc[time] = [];
Expand Down Expand Up @@ -117,7 +118,7 @@ const AssignmentsList = ({
pathname: "content/assignments/players",
params: {
drillId: assignment.drillId,
assignedTime: assignment.assignedTime,
mergeTime: assignment.mergeTime,
},
});
}
Expand Down Expand Up @@ -204,7 +205,7 @@ const AssignmentsList = ({
title: date,
data: groupedData[date],
}))}
keyExtractor={(item) => `${item.assignedTime}-${item.drillId}`}
keyExtractor={(item) => `${item.mergeTime}-${item.drillId}`}
ListHeaderComponent={children}
renderItem={({ item: assignment }) => {
const assignmentCompleted = singleUser
Expand All @@ -216,7 +217,7 @@ const AssignmentsList = ({
});
return (
<TouchableOpacity
key={`${assignment.assignedTime}-${assignment.drillId}`}
key={`${assignment.mergeTime}-${assignment.drillId}`}
onPress={() => cardPressHandler(assignment)}
disabled={disabled}
>
Expand Down

0 comments on commit 0878f5a

Please sign in to comment.