Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenakh97 committed Apr 18, 2024
1 parent 95049ee commit b86bdb9
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 9 deletions.
1 change: 1 addition & 0 deletions public/api_logo_pwrdBy_strava_stack_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions public/btn_strava_connectwith_orange.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/app/pages/Clubgoals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const ClubGoals = () => {

const fetchData = async () => {
const result = await fetch(
`https://l3svp5tprslh63jdazjgg6mdta0ocgkr.lambda-url.eu-central-1.on.aws/`,
`https://k66fzrj7leiarkgqtenq2udn3a0oznzh.lambda-url.us-east-2.on.aws/`,
)
setTimestreamData(await result.json())
setExp(
Expand Down Expand Up @@ -129,7 +129,11 @@ export const ClubGoals = () => {
}
}
const teams = Object.keys(distanceRecord)
console.log(teams)
console.log(timestreamData)

for (const team of teams) {
console.log(team)
distanceRecord[team].activeAthletes =
timestreamData.overall.teamInfo[team].memberCount
}
Expand Down
84 changes: 77 additions & 7 deletions src/app/pages/Strava.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const Strava = () => {

const fetchData = async () => {
const result = await fetch(
`https://l3svp5tprslh63jdazjgg6mdta0ocgkr.lambda-url.eu-central-1.on.aws/`,
`https://k66fzrj7leiarkgqtenq2udn3a0oznzh.lambda-url.us-east-2.on.aws/`,
)
setTimestreamData(await result.json())
setExp(
Expand Down Expand Up @@ -90,19 +90,89 @@ export const Strava = () => {
</Main>
)
}
let defaultWeekInfo: TeamInformation = [
{
teamName: 'Finland',
minutesPerAthlete: 0,
distance: 0,
teamId: 1174164,
points: 0,
},

{
teamName: 'Poland',
minutesPerAthlete: 0,
distance: 0,
teamId: 1174165,
points: 0,
},

{
teamName: 'Europe',
minutesPerAthlete: 0,
distance: 0,
teamId: 1174166,
points: 0,
},

{
teamName: 'APAC',
minutesPerAthlete: 0,
distance: 0,
teamId: 1174167,
points: 0,
},

{
teamName: 'USA',
minutesPerAthlete: 0,
distance: 0,
teamId: 1174168,
points: 0,
},

{
teamName: 'Trondheim',
minutesPerAthlete: 0,
distance: 0,
teamId: 1174140,
points: 0,
},

{
teamName: 'Omega',
minutesPerAthlete: 0,
distance: 0,
teamId: 1174791,
points: 0,
},

{
teamName: 'Oslo',
minutesPerAthlete: 0,
distance: 0,
teamId: 1174162,
points: 0,
},
]
let currenWeektTeamInformation = []
for (const weeks of timestreamData.weeks) {
if (weeks.weekNumber === weekNumber) {
currenWeektTeamInformation.push(weeks.teamInformation)
} else {
currenWeektTeamInformation = []
currenWeektTeamInformation.push(weeks.teamInformation)
}
continue /*else {
console.log('else')
//currenWeektTeamInformation = []
currenWeektTeamInformation.push(weeks.teamInformation)
}*/
}
if (currenWeektTeamInformation.length === 0) {
currenWeektTeamInformation.push(defaultWeekInfo)
}
const weeklyHoursSorted = sortSummaryByHours(currenWeektTeamInformation[0])

const graphData = summaryDataToGraphData(timestreamData.weeks)

console.log('current', currenWeektTeamInformation)
for (const team of graphData.datasets) {
for (const teamName of currenWeektTeamInformation[0]) {
if (team.label === teamName.teamName) {
Expand All @@ -114,8 +184,8 @@ export const Strava = () => {
const tableData = (currenWeektTeamInformation[0] ?? []).sort(
(a: { points: number }, b: { points: number }) => b.points - a.points,
)
console.log(tableData)

console.log('tabledata', tableData)
console.log(weeklyHoursSorted)
return (
<Main>
<>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/WeeklySummaries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const WeeklySummaries = () => {

const fetchData = async () => {
const result = await fetch(
`https://l3svp5tprslh63jdazjgg6mdta0ocgkr.lambda-url.eu-central-1.on.aws/`,
`https://k66fzrj7leiarkgqtenq2udn3a0oznzh.lambda-url.us-east-2.on.aws/`,
)
setTimestreamData(await result.json())
setExp(
Expand Down
7 changes: 7 additions & 0 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ export const Navbar = () => {
</ul>
</div>
</div>
<img
src={'/api_logo_pwrdBy_strava_stack_white.svg'}
alt={'name'}
width="100"
height="34"
className="d-inline-block align-text-top me-1"
/>
</div>
</nav>
</header>
Expand Down

0 comments on commit b86bdb9

Please sign in to comment.