Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player sheet support #51

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: Setup NPM
uses: actions/setup-node@v3
Expand Down Expand Up @@ -77,8 +77,12 @@ jobs:
REDIS_PORT: "6379"
REDIS_PASSWORD: ""
CLAUDE_ACCESSTOKEN: ""
OBJECTSTORAGE_ENDPOINT: ""
OBJECTSTORAGE_BUCKET: ""
OBJECTSTORAGE_ACCESSKEY: ""
OBJECTSTORAGE_SECRETKEY: ""
- name: Upload test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure() || always()
with:
name: test-results
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gradle:7-jdk11 AS build
FROM gradle:7-jdk17 AS build

RUN apt-get install -y curl \
&& curl -sL https://deb.nodesource.com/setup_18.x | bash - \
Expand All @@ -19,7 +19,7 @@ RUN npm run build
WORKDIR /home/gradle/src
RUN gradle shadowJar

FROM openjdk:11
FROM openjdk:17
COPY --from=build /home/gradle/src/build/libs/*.jar /app/report-system.jar
WORKDIR /app
RUN mkdir data
Expand Down
30 changes: 26 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,51 @@ val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project
val exposed_version: String by project

val coroutines_version = "1.9.0" // Added explicit coroutines version


plugins {
application
kotlin("jvm") version "1.9.22"
kotlin("plugin.serialization") version "1.7.10"
kotlin("jvm") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
id("com.github.johnrengelman.shadow") version "7.1.2"
}

group = "eu.gaelicgames"
version = "1.0-ALPHA"

kotlin {
jvmToolchain(17)
}

application {
mainClass.set("eu.gaelicgames.referee.ApplicationKt")

val isDevelopment: Boolean = true
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}


repositories {
mavenCentral()
maven { url = uri("https://www.jitpack.io") }

maven { url = uri("https://maven.pkg.jetbrains.space/public/p/ktor/eap") }
}




java.sourceSets["main"].java {
srcDir("gaa-referee-report-common/src/main/kotlin")
}

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")


implementation("com.github.Tyde:gaa-teamsheet-pdf-parser:0.3")

implementation("io.ktor:ktor-server-core-jvm:$ktor_version")
implementation("io.ktor:ktor-server-auth-jvm:$ktor_version")
implementation("io.ktor:ktor-server-auth:$ktor_version")
Expand All @@ -58,9 +74,10 @@ dependencies {
implementation("org.jetbrains.exposed", "exposed-dao", exposed_version)
implementation("org.jetbrains.exposed", "exposed-jdbc", exposed_version)
implementation("org.jetbrains.exposed", "exposed-java-time", exposed_version)
implementation("org.jetbrains.exposed", "exposed-json", exposed_version)
implementation("com.zaxxer:HikariCP:5.1.0")

implementation("com.nimbusds:nimbus-jose-jwt:9.30.1")
implementation("com.nimbusds:nimbus-jose-jwt:9.37.2")

implementation("com.mailjet", "mailjet-client", "5.2.1")

Expand All @@ -72,8 +89,13 @@ dependencies {
implementation("at.favre.lib:bcrypt:0.9.0")
implementation("org.apache.commons","commons-csv","1.9.0")

implementation("aws.sdk.kotlin:s3:1.+")

testImplementation(kotlin("test"))
testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version")

implementation("io.arrow-kt:arrow-core:1.2.4")
implementation("io.arrow-kt:arrow-fx-coroutines:1.2.4")
}
tasks.test {
useJUnitPlatform()
Expand Down
1 change: 1 addition & 0 deletions frontend-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"dependencies": {
"@heroicons/vue": "^2.1.1",
"@vueuse/core": "^10.9.0",
"caniuse-lite": "^1.0.30001687",
"debounce": "^1.2.1",
"feather-icons": "^4.29.0",
"luxon": "^3.3.0",
Expand Down
35 changes: 35 additions & 0 deletions frontend-vite/src/TeamsheetDashboard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<script setup lang="ts">
import {ref} from "vue";
import {useTeamsheetStore} from "@/utils/teamsheet_store";

const store = useTeamsheetStore();
const isLoading = ref<Boolean>(true)

{
let promiseAux = store.publicStore.loadAuxiliaryInformationFromSerer()
let promiseTurn = store.publicStore.loadTournaments()
Promise.all([promiseAux, promiseTurn])
.then(() => {
isLoading.value = false
})
.catch((e) => {
store.newError(e)
})
}

</script>

<template>
<transition-group name="p-message" tag="div">
<Message v-for="msg in store.publicStore.currentErrors" severity="error" :key="msg.timestamp">{{msg.message}}</Message>
</transition-group>
<div class="container md:w-[450px] mx-auto ">
<h1 class="text-2xl font-bold text-center mb-2">GGE Teamsheet Dashboard</h1>

<router-view></router-view>
</div>
</template>

<style scoped>

</style>
8 changes: 4 additions & 4 deletions frontend-vite/src/components/SubmitReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ async function uploadAllData() {
let updateDiAndInjuries = store.gameReports.map((gameReport) => {
if (gameReport.id) {
let tAdiP = gameReport.teamAReport.disciplinaryActions.map((da) => {
store.sendDisciplinaryAction(da, gameReport,true)
return store.sendDisciplinaryAction(da, gameReport,true)
})
let tBdiP = gameReport.teamBReport.disciplinaryActions.map((da) => {
store.sendDisciplinaryAction(da, gameReport,true)
return store.sendDisciplinaryAction(da, gameReport,true)
})
let tAinP = gameReport.teamAReport.injuries.map((injury) => {
store.sendInjury(injury, gameReport, true)
return store.sendInjury(injury, gameReport, true)
})
let tBinP = gameReport.teamBReport.injuries.map((injury) => {
store.sendInjury(injury, gameReport, true)
return store.sendInjury(injury, gameReport, true)
})
//concat all four arrays
let allPromises = tAdiP.concat(tBdiP).concat(tAinP).concat(tBinP)
Expand Down
153 changes: 153 additions & 0 deletions frontend-vite/src/components/teamsheet/AugmentTeamsheetData.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<script setup lang="ts">
import {useTeamsheetStore} from "@/utils/teamsheet_store";
import {type DatabaseTournament, tournamentByDateSortComparator} from "@/types/tournament_types";
import {DateTime} from "luxon";
import {computed, onMounted, ref} from "vue";
import {useRouter} from "vue-router";
import {loadTeamsheetPlayersFromFileKey, setTeamsheetMetaData} from "@/utils/api/teamsheet_api";
import type {Team} from "@/types/team_types";
import {GameCode} from "@/types";
import {
newTeamsheetWithClubAndTournamentDataDEO,
type TeamsheetUploadSuccessDEO,
type TeamsheetWithClubAndTournamentDataDEO
} from "@/types/teamsheet_types";
import UploadTeamsheetComponent from "@/components/teamsheet/UploadTeamsheetComponent.vue";
import CommonEditTeamsheetData from "@/components/teamsheet/CommonEditTeamsheetData.vue";

const store = useTeamsheetStore()
const router = useRouter()
const props = defineProps<{
fileKey: string
}>()

const futureTournaments = computed(() => {
return store.publicStore.tournaments.filter(function (tournament: DatabaseTournament) {
if (tournament.isLeague === true && tournament.endDate) {
return tournament.endDate.endOf('day') > DateTime.now().startOf('day')
} else {
return tournament.date.endOf('day') > DateTime.now().startOf('day')
}
}).sort(tournamentByDateSortComparator)
})

const clubs = computed(() => {
return store.publicStore.teams.filter((team) => team.isAmalgamation === false)
})



const teamsheetData = ref<TeamsheetWithClubAndTournamentDataDEO>(newTeamsheetWithClubAndTournamentDataDEO())

const isSending = ref<boolean>(false)
const isUploading = ref<boolean>(false)

onMounted(() => {

if (!store.uploadSuccessDEO) {
const fileKey = props.fileKey
console.log("fileKey", fileKey)
if (fileKey) {
loadTeamsheetPlayersFromFileKey(fileKey)
.then((response) => {
console.log("response", response)
store.uploadSuccessDEO = response
loadStoreDataIntoTeamsheetData()
})
.catch((e) => {
store.newError(e)
router.push("/")
})

} else {
loadStoreDataIntoTeamsheetData()
//router.push("/")
}

}

})

function loadStoreDataIntoTeamsheetData() {
teamsheetData.value.players = store.uploadSuccessDEO?.players || []
teamsheetData.value.fileKey = store.uploadSuccessDEO?.fileKey || ""
}

function sendAugmentedData() {
const players = teamsheetData.value.players
if (players.length === 0) {
store.newError("No players found in the teamsheet")
return
}
if (teamsheetData.value.tournamentId == -1) {
store.newError("Please select a tournament")
return
}
if (teamsheetData.value.clubId == -1) {
store.newError("Please select a team")
return
}
if (teamsheetData.value.registrarName == "") {
store.newError("Please enter your name")
return
}
if (teamsheetData.value.registrarMail == "") {
store.newError("Please enter your email")
return
}
if (teamsheetData.value.codeId == -1) {
store.newError("Please select a code")
return
}
if (teamsheetData.value.fileKey == "") {
store.newError("No file key found")
return
}
isSending.value = true
const metadata = {
players: teamsheetData.value.players,
clubId:teamsheetData.value.clubId,
tournamentId: teamsheetData.value.tournamentId,
registrarName: teamsheetData.value.registrarName,
registrarMail: teamsheetData.value.registrarMail,
fileKey: teamsheetData.value.fileKey,
codeId: teamsheetData.value.codeId
} as TeamsheetWithClubAndTournamentDataDEO
setTeamsheetMetaData(metadata)
.then(() => {
isSending.value = false
router.push({name: "teamsheet-complete", params: {fileKey: teamsheetData.value.fileKey}})
})
.catch((e) => {
isSending.value = false
store.newError(e)
})

}

function onUploadComplete(newFileKey: string) {
isUploading.value = false
console.log("Upload complete")
router.push({name: "augment-data", params: {fileKey: newFileKey}})
}
</script>

<template>
<div>
<template v-if="store.uploadSuccessDEO">
<CommonEditTeamsheetData
:model-value="teamsheetData"
@onFileKeyChanged="onUploadComplete"
@submitData="sendAugmentedData"
/>
</template>
<template v-else>
<h3>Loading...</h3>
</template>

</div>
</template>

<style scoped>

</style>
Loading
Loading