Merge branch 'master' of https://vcs.maemo.org/git/buliscores
[buliscores] / src / src / match.cpp
index b65ad4b..cb8fdb6 100644 (file)
@@ -4,7 +4,6 @@ Match::Match(QString hometeam, QString awayteam, QDateTime date, QObject *parent
     QObject(parent)
 {
     m_date = date;
-    m_lastevent = QDateTime::currentDateTime();
 
     m_homeTeam = hometeam;
     m_awayTeam = awayteam;
@@ -137,27 +136,29 @@ void Match::setScore(int home, int away, bool notifyWatchers)
 
     if (m_homeScore != home) {
         m_homeScore = home;
+        if (oldhomescore != -1) {
+            m_lastHomeGoal = QDateTime::currentDateTime();
+        }
         changed = true;
     }
 
     if (m_awayScore != away) {
         m_awayScore = away;
+        if (oldawayscore != -1) {
+            m_lastAwayGoal = QDateTime::currentDateTime();
+        }
         changed = true;
     }
 
-    if (changed) {
-        m_lastevent = QDateTime::currentDateTime();
-        if(notifyWatchers) {
-            emit scoreChanged(oldhomescore, oldawayscore,
-                              home, away);
-        }
+    if (changed && notifyWatchers) {
+        emit scoreChanged(oldhomescore, oldawayscore,
+                          home, away);
     }
 }
 
 void Match::setState(MatchState state, bool notifyWatchers) {
     if (m_state != state) {
         m_state = state;
-        m_lastevent = QDateTime::currentDateTime();
         if (notifyWatchers) {
             emit stateChanged(state);
         }