From 88ea058b7d547ac9538ed70af6dddac98e330a50 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 7 May 2023 05:21:12 -0500 Subject: [PATCH] Removed all warnings --- src/App.js | 94 ++++++++++++++++++++++++++---------------------------- 1 file changed, 45 insertions(+), 49 deletions(-) diff --git a/src/App.js b/src/App.js index d6aa6e6..ab92eb1 100755 --- a/src/App.js +++ b/src/App.js @@ -1,4 +1,3 @@ -import logo from './logo512.png'; import './App.css'; import 'bootstrap/dist/css/bootstrap.min.css'; @@ -35,7 +34,6 @@ const progress2 = new Audio(process.env.PUBLIC_URL+"/progress2.mp3") function ItemGroup(p) { const { data } = p const { contributor } = p - const { setData1,setData2,setData3,setData4,setLastModified,lastModified } = p const [displayData,setDisplayData] = useState([]) const [lockout,setLockout] = useState(false) @@ -44,6 +42,7 @@ function ItemGroup(p) { if (b.required===b.obtained&&a.required!==a.obtained) {return -1} if (b.required===b.obtained&&a.required===a.obtained) {return a.id-b.id} if (b.required!==b.obtained&&a.required!==a.obtained) {return a.id-b.id} + return 0 })) },[data]) @@ -57,9 +56,9 @@ function ItemGroup(p) { function updateItem(item,target,contributor) { var correctedVal=Math.min(item.required,target.value); - if (correctedVal==item.obtained) {return;} + if (correctedVal===Number(item.obtained)) {return;} setLockout(true) - axios.post(BACKEND_URL+"/updateItem",{obtained:correctedVal,id:item.id,last_modified:new Date(),item_name:item.name,username:contributor,required:item.required,operation:correctedVal==item.required?"FINISH":correctedVal>item.obtained?"INCREASE":"SET",previous_amt:item.obtained}) + axios.post(BACKEND_URL+"/updateItem",{obtained:correctedVal,id:item.id,last_modified:new Date(),item_name:item.name,username:contributor,required:item.required,operation:correctedVal===Number(item.required)?"FINISH":correctedVal>item.obtained?"INCREASE":"SET",previous_amt:item.obtained}) .then((data)=>{ setLockout(false) }) @@ -73,7 +72,7 @@ function ItemGroup(p) { {displayData.map((item,i,arr)=> - {item.name} + {item.name}/ {item.name} } @@ -172,14 +170,14 @@ function SorterApp(){ setChecking(false) return } else - if (itemData1.ItemSortCategory.ID==itemData2.ItemSortCategory.ID&& + if (itemData1.ItemSortCategory.ID===itemData2.ItemSortCategory.ID&& itemData1.ItemUICategory.ID{ - setTimeout(downloadData(d,val+1,max),250) - }) - .catch((err)=>{ - setFailed(failed+1) - }) - } - } - useEffect(()=>{ if (update) { axios.get("https://projectdivar.com:4505/getData") @@ -491,15 +452,50 @@ function App() { if (succeeded+failed===total) { setUpdate(true) } - },[succeeded,failed]) + },[succeeded,failed,total]) useEffect(()=>{ + + const downloadData=(d,val,max)=>{ + if (val{ + setTimeout(downloadData(d,val+1,max),250) + }) + .catch((err)=>{ + setFailed(failed+1) + }) + } + } + var d = parse(fileData,{columns:true,skip_empty_lines:true}) console.log(d) - var promises = [] downloadData(d,0,d.length) setTotal(d.length) - },[fileData]) + },[fileData,failed,succeeded]) return (