Skip to content

Commit ed47497

Browse files
authored
weight based rating accumulation (#13)
* use weights for score calc, backend part 1 * backend fixes, improvements * fix rating results for season fetcher function * prettier, result list page first refactor * stage general score fix, show criterion scores on result list page * show score for categories, root * don't save RRI for roles without age groups * don't try to verify user roles if they're not signed in * add score calculation timestamp to event * store total rating count in event * fix result details page * various fixes, cleanup * more cleanup * faq page and more fixes
1 parent 36a9092 commit ed47497

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+986
-457
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ az-login.bat
4747

4848
# Azurite stuff
4949
__azurite*.json
50+
__azurite*.json~
5051
__blobstorage__/
5152
__queuestorage__/

.vscode/extensions.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
{
2-
"recommendations": ["ms-azuretools.vscode-azurefunctions", "nrwl.angular-console", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint", "Azurite.azurite"]
2+
"recommendations": [
3+
"ms-azuretools.vscode-azurefunctions",
4+
"nrwl.angular-console",
5+
"esbenp.prettier-vscode",
6+
"dbaeumer.vscode-eslint",
7+
"Azurite.azurite"
8+
]
39
}

package-lock.json

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"react-hook-form": "^7.43.8",
3232
"react-icons": "^4.8.0",
3333
"react-router-dom": "^6.9.0",
34+
"react-router-hash-link": "^2.4.3",
3435
"recharts": "^2.12.7",
3536
"reflect-metadata": "^0.1.13",
3637
"tsconfig-paths": "^4.2.0",
@@ -52,6 +53,7 @@
5253
"@types/lodash.debounce": "^4.0.9",
5354
"@types/react": "18.2.14",
5455
"@types/react-dom": "18.2.6",
56+
"@types/react-router-hash-link": "^2.4.9",
5557
"@typescript-eslint/eslint-plugin": "^5.60.1",
5658
"@typescript-eslint/parser": "^5.60.1",
5759
"@vitejs/plugin-react": "~4.0.0",

packages/client/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

packages/client/src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { AuthorizedPage } from './pages/authorized/Authorized.page'
77
import { ErrorPage } from './pages/error/error.page'
88
import { EventDetailsPage } from './pages/events/EventDetails.page'
99
import { IndexPage } from './pages/events/Index.page'
10-
import { ImpressumPage } from './pages/impressum/Impressum.page'
10+
import { FAQPage } from './pages/faq/FAQ.page'
1111
import { LoginPage } from './pages/Login.page'
1212
import { ProfilePage } from './pages/profile/Profile.page'
1313
import { RatingPage } from './pages/ratings/Rating.page'
@@ -105,8 +105,8 @@ export const App = () => {
105105
</Route>
106106
</Route>
107107
</Route>
108-
<Route path={PATHS.IMPRESSUM}>
109-
<Route index element={<ImpressumPage />} />
108+
<Route path={PATHS.FAQ}>
109+
<Route index element={<FAQPage />} />
110110
</Route>
111111
</Routes>
112112
</Suspense>

packages/client/src/api/contexts/AuthContext.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export const AuthContext = createContext<AuthContextType>({
2424
loggedInUser: undefined,
2525
loggedInUserLoading: false,
2626
loggedInUserError: undefined,
27-
onLoginSuccess: () => { },
28-
onLogout: () => { },
29-
refetchUser: async () => { },
27+
onLoginSuccess: () => {},
28+
onLogout: () => {},
29+
refetchUser: async () => {},
3030
})
3131

3232
export const AuthProvider = ({ children }: PropsWithChildren) => {
@@ -37,12 +37,14 @@ export const AuthProvider = ({ children }: PropsWithChildren) => {
3737
const { mutate: verifyUserRoles } = useValidateUserRolesMutation()
3838

3939
useEffect(() => {
40-
verifyUserRoles(undefined, {
41-
onSuccess: (res) => {
42-
Cookies.set(CookieKeys.JWT_TOKEN, res.token, { expires: 2 })
43-
},
44-
})
45-
}, [verifyUserRoles])
40+
if (isLoggedIn) {
41+
verifyUserRoles(undefined, {
42+
onSuccess: (res) => {
43+
Cookies.set(CookieKeys.JWT_TOKEN, res.token, { expires: 2 })
44+
},
45+
})
46+
}
47+
}, [verifyUserRoles, isLoggedIn])
4648

4749
const onLoginSuccess = (jwt: string) => {
4850
Cookies.set(CookieKeys.JWT_TOKEN, jwt, { expires: 2 })

packages/client/src/api/contexts/CacheContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type CacheContextType = {
1616
export const CacheContext = createContext<CacheContextType>({
1717
dbQueryLoading: true,
1818
eventDataLoading: true,
19-
refetchEventData: () => { },
19+
refetchEventData: () => {},
2020
eventData: undefined,
2121
eventDataError: undefined,
2222
})

packages/client/src/api/contexts/ResultTableContext.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ export const ResultTableContext = createContext<ResultTableContextType>({
4545
sortCriterion: undefined,
4646
sortOrder: 'desc',
4747

48-
setSelectedCategoryIds: () => { },
49-
setSelectedCriterionIds: () => { },
50-
setIncludeTotal: () => { },
51-
setNationalOnly: () => { },
52-
setSelectedAgeGroups: () => { },
53-
setSelectedRoles: () => { },
48+
setSelectedCategoryIds: () => {},
49+
setSelectedCriterionIds: () => {},
50+
setIncludeTotal: () => {},
51+
setNationalOnly: () => {},
52+
setSelectedAgeGroups: () => {},
53+
setSelectedRoles: () => {},
5454

5555
resultsLoading: true,
5656
sortedEvents: [],
5757

58-
selectedSeasonChange: () => { },
59-
sendResultRequest: () => { },
60-
sortByCrit: () => { },
61-
saveToLocalStorage: () => { },
58+
selectedSeasonChange: () => {},
59+
sendResultRequest: () => {},
60+
sortByCrit: () => {},
61+
saveToLocalStorage: () => {},
6262
})

packages/client/src/components/Footer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Box, Container, Flex, HStack, Link, Stack, Text } from '@chakra-ui/react'
22
import { FC } from 'react'
33
import { FaEnvelope, FaGithub, FaGlobe, FaLinkedin } from 'react-icons/fa'
4+
import { HashLink } from 'react-router-hash-link'
45
import { ColorfulExternalLink } from './commons/ColorfulExternalLink'
56

67
export const Footer: FC = () => {
@@ -25,9 +26,9 @@ export const Footer: FC = () => {
2526
MTFSZ
2627
</Link>{' '}
2728
megbízásából.{' '}
28-
<Link href="/impressum" color="brand.500">
29+
<HashLink to="/faq#impressum" style={{ color: '#0a723a' }}>
2930
Impresszum
30-
</Link>
31+
</HashLink>
3132
</Text>
3233
</Stack>
3334

0 commit comments

Comments
 (0)