Fix highlighting bug on registration

This commit is contained in:
Dorian Zedler 2021-06-17 15:36:57 +02:00
parent 2213765a39
commit 14bbd77e71
Signed by: dorian
GPG key ID: 989DE36109AFA354
2 changed files with 19 additions and 9 deletions

View file

@ -42,6 +42,7 @@ DataListView {
} }
property var widgetData: currentWidgetData property var widgetData: currentWidgetData
property var athletes
function getSubtitle() { function getSubtitle() {
var titleString var titleString
@ -90,7 +91,7 @@ DataListView {
return widgetData[ "athletes" ][index]["firstname"] + " " + widgetData[ "athletes" ][index]["lastname"] + " (" + fedName + ")" return widgetData[ "athletes" ][index]["firstname"] + " " + widgetData[ "athletes" ][index]["lastname"] + " (" + fedName + ")"
} }
function changeCat(){ function changeCat() {
var cats = control.widgetData["categorys"] var cats = control.widgetData["categorys"]
cats.sort(function(a, b) { cats.sort(function(a, b) {
@ -110,6 +111,14 @@ DataListView {
selector.appear(selectOptions, qsTr("select cat")) selector.appear(selectOptions, qsTr("select cat"))
} }
function filterAthletes(athletes) {
var filtered = athletes.filter(function(athlete){
return parseInt(athlete.cat) === parseInt(params.cat)
})
return filtered
}
Connections { Connections {
target: selector target: selector
function onSelectionFinished(index, data) { function onSelectionFinished(index, data) {
@ -119,12 +128,9 @@ DataListView {
} }
} }
status: model === 0 ? 901:200
model: widgetData[ 'athletes' ] === undefined ? 0:widgetData[ 'athletes' ].length
Component.onCompleted: { Component.onCompleted: {
if(model > 0){ athletes = filterAthletes(widgetData["athletes"])
if(athletes.length > 0){
control.ready = true control.ready = true
control.status = 200 control.status = 200
} }
@ -136,16 +142,19 @@ DataListView {
onRefresh: { onRefresh: {
updateData({}, false) updateData({}, false)
athletes = []
athletes = filterAthletes(widgetData["athletes"])
} }
model: athletes
delegate: ItemDelegate { delegate: ItemDelegate {
id: partDel id: partDel
property int thisIndex: index property int thisIndex: index
property var thisData: widgetData[ "athletes" ][index] property var thisData: modelData
width: parent.width width: parseInt(thisData.cat) === parseInt(params.cat) ? control.width:control.width * 0.2
height: parseInt(thisData.cat) === parseInt(params.cat) ? 50:0
opacity: 0 opacity: 0
scale: 0.9 scale: 0.9

View file

@ -134,6 +134,7 @@ Window {
//mainStack.push("Pages/AthleteSearchPage.qml") //mainStack.push("Pages/AthleteSearchPage.qml")
//openWidget({comp: 11651, cat: 26}) //openWidget({comp: 11651, cat: 26})
//openWidget({person: 6623}) //openWidget({person: 6623})
openWidget({cat: 35, comp: 11181, type: "starters"})
} }
FontLoader { FontLoader {