fix(EventInfoPage): show comptitor statistics
This commit is contained in:
		
							parent
							
								
									b672b4698c
								
							
						
					
					
						commit
						d0df3af583
					
				| 
						 | 
					@ -4,8 +4,8 @@ import QtQuick.Controls
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Page {
 | 
					Page {
 | 
				
			||||||
  id: root
 | 
					  id: root
 | 
				
			||||||
  property string eventName
 | 
					  required property string eventName
 | 
				
			||||||
  property list<QtObject> competitors
 | 
					  required property list<QtObject> competitors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  header: ToolBar {
 | 
					  header: ToolBar {
 | 
				
			||||||
    ToolButton {
 | 
					    ToolButton {
 | 
				
			||||||
| 
						 | 
					@ -31,17 +31,27 @@ Page {
 | 
				
			||||||
    bottomMargin: 48
 | 
					    bottomMargin: 48
 | 
				
			||||||
    rightMargin: 48
 | 
					    rightMargin: 48
 | 
				
			||||||
    spacing: 20
 | 
					    spacing: 20
 | 
				
			||||||
    model: eventName
 | 
					    model: competitors
 | 
				
			||||||
    delegate: ItemDelegate {
 | 
					    delegate: ItemDelegate {
 | 
				
			||||||
      text: "sadly not working..."
 | 
					      required property string name
 | 
				
			||||||
 | 
					      required property string noc
 | 
				
			||||||
 | 
					      required property string mark
 | 
				
			||||||
 | 
					      required property string statistic
 | 
				
			||||||
 | 
					      required property string gold
 | 
				
			||||||
 | 
					      required property string silver
 | 
				
			||||||
 | 
					      required property string bronze
 | 
				
			||||||
      width: listView.width - listView.leftMargin - listView.rightMargin
 | 
					      width: listView.width - listView.leftMargin - listView.rightMargin
 | 
				
			||||||
      height: avatar.implicitHeight + 32
 | 
					      height: 32
 | 
				
			||||||
      leftPadding: avatar.implicitWidth + 32
 | 
					      Text { 
 | 
				
			||||||
 | 
					        anchors.left: parent.left
 | 
				
			||||||
      Image {
 | 
					        text: name + " (" + noc + ")"
 | 
				
			||||||
        id: avatar
 | 
					 | 
				
			||||||
        // source: "images/" + modelData.replace(" ", "_") + ".png"
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      Text { 
 | 
				
			||||||
 | 
					        anchors.right: parent.right
 | 
				
			||||||
 | 
					        horizontalAlignment: Text.AlignRight
 | 
				
			||||||
 | 
					        text: mark + " " + statistic + " | " + gold + "🥇 " + silver + "🥈 " + bronze + "🥉"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -254,7 +254,7 @@ Page {
 | 
				
			||||||
      model: filter
 | 
					      model: filter
 | 
				
			||||||
      delegate: ItemDelegate {
 | 
					      delegate: ItemDelegate {
 | 
				
			||||||
        required property string eventName
 | 
					        required property string eventName
 | 
				
			||||||
        property list<QtObject> competitors
 | 
					        required property list<QtObject> competitors
 | 
				
			||||||
        text: eventName
 | 
					        text: eventName
 | 
				
			||||||
        width: listView.width - listView.leftMargin - listView.rightMargin
 | 
					        width: listView.width - listView.leftMargin - listView.rightMargin
 | 
				
			||||||
        height: avatar.height 
 | 
					        height: avatar.height 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,9 +101,9 @@ void SportModel::parseData() {
 | 
				
			||||||
          Competitor *comp = new Competitor(this);
 | 
					          Competitor *comp = new Competitor(this);
 | 
				
			||||||
          comp->setCompetitor(competitor.toObject());
 | 
					          comp->setCompetitor(competitor.toObject());
 | 
				
			||||||
          if (medals.find(comp->name()) != medals.end()) comp->setMedals(medals.find(comp->name())->second);
 | 
					          if (medals.find(comp->name()) != medals.end()) comp->setMedals(medals.find(comp->name())->second);
 | 
				
			||||||
          if (!competitors.empty()) comp->setStatistic(competitors.first()->mark());
 | 
					 | 
				
			||||||
          competitors << comp;
 | 
					          competitors << comp;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        addRelativeToFirst(competitors);
 | 
				
			||||||
        event->setCompetitors(competitors);
 | 
					        event->setCompetitors(competitors);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        qDebug() << entry["eventUnitName"].toString();
 | 
					        qDebug() << entry["eventUnitName"].toString();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue