Skip to content

Commit

Permalink
Shashank_Fix_Lint_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankhv committed Feb 1, 2025
1 parent 75830fa commit 913cad2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/components/Timelog/Timelog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,6 @@ function Timelog(props) {
const { userId: urlId } = useParams();
const [userprofileId, setUserProfileId] = useState(urlId || authUser.userid);

const doesUserHaveTaskWithWBS = userHaveTask => {
return userHaveTask.reduce((acc, item) => {
const hasIncompleteTask = item.resources.some(
val =>
(viewingUser.userId === val.userID || val.userID === userprofileId) &&
val.completedTask === false,
);
if (hasIncompleteTask) acc.push(item);
return acc;
}, []);
};

const checkSessionStorage = () => JSON.parse(sessionStorage.getItem('viewingUser')) ?? false;
const [viewingUser, setViewingUser] = useState(checkSessionStorage());
const getUserId = () => {
Expand All @@ -160,6 +148,18 @@ function Timelog(props) {
}
};

const doesUserHaveTaskWithWBS = userHaveTask => {
return userHaveTask.reduce((acc, item) => {
const hasIncompleteTask = item.resources.some(
val =>
(viewingUser.userId === val.userID || val.userID === userprofileId) &&
val.completedTask === false,
);
if (hasIncompleteTask) acc.push(item);
return acc;
}, []);
};

const [displayUserId, setDisplayUserId] = useState(getUserId());
const isAuthUser = authUser.userid === displayUserId;
const fullName = `${displayUserProfile.firstName} ${displayUserProfile.lastName}`;
Expand Down

0 comments on commit 913cad2

Please sign in to comment.