Hi again,

>
> Thanks for your interest and feedback!
>
> > Great work, love pytrainer and have been using it for a while!
>
> Good to hear (read)! ;)
>
> > I downloaded
> > 1.9.1 and like some of the new features (although I notice graphs still show
> > metric labelled as miles).
>
> Ooops! This may be linked to
> http://sourceforge.net/apps/trac/pytrainer/ticket/161
>
> > Anyway, on upgrading I think it updated my date?  It then crashes while
> > examining sports (see attached).  If fixed it anyway by just skipping over
> > the error in stats.py.
> >
> > *** ./stats.py  2011-11-25 18:56:26.000000000 +0000
> > --- /usr/local/lib/python2.7/dist-packages/pytrainer/stats.py   2012-01-11
> > 19:16:30.000000000 +0000
> > ***************
> > *** 56,61 ****
> > --- 56,63 ----
> >                  continue
> >              if r['sport'] not in data['sports']:
> >                  sport = self._sport_service.get_sport(r['sport'])
> > +                 if sport is None:
> > +                     continue
> >                  data['sports'][r['sport']] = {'name': sport.name, 'count':
> > 0}
> >                  for f in fields:
> >                      data['sports'][r['sport']][f] = 0
> >
> > pytrainer then starts OK, working fine so far!
>
> Thanks for reporting. I did some upgrade tests myself and it looks I
> skip some scenarios. I will have a deeper look and submit your change
> if necessary.

I was about to commit Jason's change but I see something strange in
stats.py 
(https://github.com/pytrainer/pytrainer/blob/master/pytrainer/stats.py):

If second 'if' statement has been reached in 'for' loop is because
r['sport'] value is valid and greater than 0, but the exception he got
makes me think that sport service called wasn't able to find suitable
references for it, not that sport id itself is not valid. So if I am
right, Jason's workaround overcomes the launch of exception but
prevents pytrainer to build correct statistics related to a valid
sport.

I am not really familiar with sport service, but I guess correct
approach would be to somehow create a new sport reference in it based
on valid sport id received, otherwise future entries with same sport
id will be skipped as well. Ideas from anyone?

Jason, do you miss any sport when looking at your statistics?

Regards,

David

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Pytrainer-devel mailing list
Pytrainer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytrainer-devel

Reply via email to