Skip to content

Commit

Permalink
Merge pull request #404 from euanwm/chore/drop_ig_value
Browse files Browse the repository at this point in the history
drop ig feature
  • Loading branch information
euanwm authored Sep 30, 2024
2 parents 845c204 + 380b8cf commit 41be351
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 189 deletions.
1 change: 0 additions & 1 deletion backend/dbtools/dbtools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ func Test_assignStruct(t *testing.T) {
Total: 330,
Sinclair: 0,
Federation: "BWL",
Instagram: "",
},
}}
for _, tt := range tests {
Expand Down
3 changes: 0 additions & 3 deletions backend/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ var DiscoKaren discordbot.DiscordBot
// LeaderboardData is a global variable that is used to hold the leaderboard data.
var LeaderboardData structs.LeaderboardData

// this is remnant of the instagram linking code
// var lifterData = lifter.Build()

// QueryCache is a global variable that is used to cache queries for the leaderboard endpoint.
var QueryCache dbtools.QueryCache

Expand Down
39 changes: 0 additions & 39 deletions backend/lifter/instagram.go

This file was deleted.

53 changes: 0 additions & 53 deletions backend/lifter/instagram_test.go

This file was deleted.

8 changes: 0 additions & 8 deletions backend/lifterdata/igdatabase.go

This file was deleted.

8 changes: 0 additions & 8 deletions backend/lifterdata/ighandles.csv

This file was deleted.

1 change: 0 additions & 1 deletion backend/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ type Entry struct {
Total float32 `json:"total"`
Sinclair float32 `json:"sinclair"`
Federation string `json:"country"`
Instagram string `json:"instagram"`
}

type LeaderboardResponse struct {
Expand Down
35 changes: 0 additions & 35 deletions backend/utilities/utilities_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package utilities

import (
igDatabase "backend/lifterdata"
"io"
"io/fs"
"log"
"reflect"
"testing"
"time"
Expand Down Expand Up @@ -59,37 +55,6 @@ func TestFloat(t *testing.T) {
}
}

func TestLoadCsvFile(t *testing.T) {
fileHandle, err := igDatabase.InstagramDatabase.Open("ighandles.csv")
if err != nil {
log.Fatal(err)
}
defer func(fileHandle fs.File) {
err := fileHandle.Close()
if err != nil {
log.Fatal(err)
}
}(fileHandle)

type args struct {
file io.Reader
}
tests := []struct {
name string
args args
wantedTypeOf [][]string
}{
{name: "LoadCsvFile", args: args{file: fileHandle}, wantedTypeOf: [][]string{}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := LoadCsvFile(tt.args.file); !reflect.DeepEqual(reflect.TypeOf(got), reflect.TypeOf(tt.wantedTypeOf)) {
t.Errorf("LoadCsvFile() = %v, want %v", got, tt.wantedTypeOf)
}
})
}
}

func TestMapContains(t *testing.T) {
type args struct {
StrQuery string
Expand Down
41 changes: 20 additions & 21 deletions frontend/api/fetchLifterData/fetchLifterDataTypes.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
export type LifterResult = {
event: string;
date: string;
gender: string;
lifter_name: string;
bodyweight: number;
snatch_1: number;
snatch_2: number;
snatch_3: number;
cj_1: number;
cj_2: number;
cj_3: number;
best_snatch: number;
best_cj: number;
total: number;
sinclair: number;
country: string;
instagram: string;
};
event: string
date: string
gender: string
lifter_name: string
bodyweight: number
snatch_1: number
snatch_2: number
snatch_3: number
cj_1: number
cj_2: number
cj_3: number
best_snatch: number
best_cj: number
total: number
sinclair: number
country: string
}

export type LeaderboardResult = {
size: number;
data: LifterResult[];
}
size: number
data: LifterResult[]
}
30 changes: 10 additions & 20 deletions frontend/components/molecules/dataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { CgProfile } from 'react-icons/cg'

import { AllDetails } from './allDetails'

import { LifterResult, LeaderboardResult } from '@/api/fetchLifterData/fetchLifterDataTypes'
import {
LifterResult,
LeaderboardResult,
} from '@/api/fetchLifterData/fetchLifterDataTypes'

export const DataTable = ({
lifters,
Expand All @@ -23,37 +26,24 @@ export const DataTable = ({
openLifterGraphHandler: (lifterName: string) => void
}) => {
const generateLifterRow = (lifter: LifterResult, lifterNo: number) => {
const {
lifter_name,
instagram,
country,
best_snatch,
best_cj,
total,
sinclair,
} = lifter
const { lifter_name, country, best_snatch, best_cj, total, sinclair } =
lifter
const lifter_page = 'lifter?name=' + lifter_name

return (
<TableRow key={`lifter-${lifterNo}`}>
<TableCell>{lifterNo}</TableCell>
<TableCell>{lifter_name}</TableCell>
<TableCell className="space-x-3 whitespace-nowrap">
<button onClick={() => openLifterGraphHandler(lifter_name)} aria-label="lifter history graph">
<button
onClick={() => openLifterGraphHandler(lifter_name)}
aria-label="lifter history graph"
>
<VscGraphLine size={25} />
</button>
<Link href={lifter_page} aria-label="lifter profile page">
<CgProfile size={25} />
</Link>
{instagram && (
<a
href={`https://www.instagram.com/${instagram}`}
className=" inline-block "
aria-label="lifter instagram"
>
<FaInstagram size={25} />
</a>
)}
</TableCell>
<TableCell>{country}</TableCell>
<TableCell>{best_snatch}</TableCell>
Expand Down

0 comments on commit 41be351

Please sign in to comment.