API & Client - replace user id with username in activities, records and stats
This commit is contained in:
parent
9f487a4d68
commit
6270b15e11
@ -179,7 +179,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -188,7 +188,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="s2">"0:17:04"</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="s2">"0:17:04"</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -197,7 +197,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -206,14 +206,14 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
<span class="p">],</span>
|
<span class="p">],</span>
|
||||||
<span class="nt">"segments"</span><span class="p">:</span> <span class="p">[],</span>
|
<span class="nt">"segments"</span><span class="p">:</span> <span class="p">[],</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"title"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"title"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</span>
|
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</span>
|
||||||
@ -324,7 +324,7 @@
|
|||||||
<span class="nt">"segments"</span><span class="p">:</span> <span class="p">[],</span>
|
<span class="nt">"segments"</span><span class="p">:</span> <span class="p">[],</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"title"</span><span class="p">:</span> <span class="s2">"biking on sunday morning"</span><span class="p">,</span>
|
<span class="nt">"title"</span><span class="p">:</span> <span class="s2">"biking on sunday morning"</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</span>
|
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</span>
|
||||||
@ -420,7 +420,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -429,7 +429,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="s2">"0:17:04"</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="s2">"0:17:04"</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -438,7 +438,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -447,14 +447,14 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
<span class="p">],</span>
|
<span class="p">],</span>
|
||||||
<span class="nt">"segments"</span><span class="p">:</span> <span class="p">[],</span>
|
<span class="nt">"segments"</span><span class="p">:</span> <span class="p">[],</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"title"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"title"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</span>
|
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</span>
|
||||||
@ -548,7 +548,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -557,7 +557,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="s2">"0:17:04"</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="s2">"0:17:04"</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -566,7 +566,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -575,14 +575,14 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
<span class="p">],</span>
|
<span class="p">],</span>
|
||||||
<span class="nt">"segments"</span><span class="p">:</span> <span class="p">[],</span>
|
<span class="nt">"segments"</span><span class="p">:</span> <span class="p">[],</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"title"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"title"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</span>
|
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</span>
|
||||||
@ -673,7 +673,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -682,7 +682,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="s2">"0:17:04"</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="s2">"0:17:04"</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -691,7 +691,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -700,14 +700,14 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mf">10.0</span>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
<span class="p">],</span>
|
<span class="p">],</span>
|
||||||
<span class="nt">"segments"</span><span class="p">:</span> <span class="p">[],</span>
|
<span class="nt">"segments"</span><span class="p">:</span> <span class="p">[],</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"title"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"title"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||||
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</span>
|
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</span>
|
||||||
|
@ -159,7 +159,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">9</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">9</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mi">18</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mi">18</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -168,7 +168,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mi">18</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mi">18</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -177,7 +177,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">11</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">11</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="s2">"1:01:00"</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="s2">"1:01:00"</span>
|
||||||
<span class="p">},</span>
|
<span class="p">},</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
@ -186,7 +186,7 @@
|
|||||||
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">12</span><span class="p">,</span>
|
<span class="nt">"id"</span><span class="p">:</span> <span class="mi">12</span><span class="p">,</span>
|
||||||
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
|
<span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
|
||||||
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||||||
<span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
<span class="nt">"user"</span><span class="p">:</span> <span class="s2">"admin"</span><span class="p">,</span>
|
||||||
<span class="nt">"value"</span><span class="p">:</span> <span class="mi">18</span>
|
<span class="nt">"value"</span><span class="p">:</span> <span class="mi">18</span>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
<span class="p">]</span>
|
<span class="p">]</span>
|
||||||
|
@ -126,20 +126,20 @@
|
|||||||
<div class="section" id="statistics">
|
<div class="section" id="statistics">
|
||||||
<h1>Statistics<a class="headerlink" href="#statistics" title="Permalink to this headline">¶</a></h1>
|
<h1>Statistics<a class="headerlink" href="#statistics" title="Permalink to this headline">¶</a></h1>
|
||||||
<dl class="get">
|
<dl class="get">
|
||||||
<dt id="get--api-stats-(int-user_id)-by_sport">
|
<dt id="get--api-stats-(user_name)-by_sport">
|
||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/stats/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">user_id</em><span class="sig-paren">)</span><code class="sig-name descname">/by_sport</code><a class="headerlink" href="#get--api-stats-(int-user_id)-by_sport" title="Permalink to this definition">¶</a></dt>
|
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/stats/</code><span class="sig-paren">(</span><em class="sig-param">user_name</em><span class="sig-paren">)</span><code class="sig-name descname">/by_sport</code><a class="headerlink" href="#get--api-stats-(user_name)-by_sport" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd><p>Get activities statistics for a user by sport</p>
|
<dd><p>Get activities statistics for a user by sport</p>
|
||||||
<p><strong>Example requests</strong>:</p>
|
<p><strong>Example requests</strong>:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><p>without parameters (get stats for all sports with activities)</p></li>
|
<li><p>without parameters (get stats for all sports with activities)</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/1/by_sport</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/admin/by_sport</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><p>with sport id</p></li>
|
<li><p>with sport id</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/1/by_sport?sport_id=1</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/admin/by_sport?sport_id=1</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p><strong>Example responses</strong>:</p>
|
<p><strong>Example responses</strong>:</p>
|
||||||
@ -191,7 +191,7 @@
|
|||||||
<dt class="field-odd">Parameters</dt>
|
<dt class="field-odd">Parameters</dt>
|
||||||
<dd class="field-odd"><ul class="simple">
|
<dd class="field-odd"><ul class="simple">
|
||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
|
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
|
||||||
<li><p><strong>user_id</strong> (<em>integer</em>) – user id</p></li>
|
<li><p><strong>user_name</strong> (<em>integer</em>) – user name</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
<dt class="field-even">Query Parameters</dt>
|
<dt class="field-even">Query Parameters</dt>
|
||||||
@ -224,20 +224,20 @@
|
|||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="get">
|
<dl class="get">
|
||||||
<dt id="get--api-stats-(int-user_id)-by_time">
|
<dt id="get--api-stats-(user_name)-by_time">
|
||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/stats/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">user_id</em><span class="sig-paren">)</span><code class="sig-name descname">/by_time</code><a class="headerlink" href="#get--api-stats-(int-user_id)-by_time" title="Permalink to this definition">¶</a></dt>
|
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/stats/</code><span class="sig-paren">(</span><em class="sig-param">user_name</em><span class="sig-paren">)</span><code class="sig-name descname">/by_time</code><a class="headerlink" href="#get--api-stats-(user_name)-by_time" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd><p>Get activities statistics for a user by time</p>
|
<dd><p>Get activities statistics for a user by time</p>
|
||||||
<p><strong>Example requests</strong>:</p>
|
<p><strong>Example requests</strong>:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><p>without parameters</p></li>
|
<li><p>without parameters</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/1/by_time</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/admin/by_time</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><p>with parameters</p></li>
|
<li><p>with parameters</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/1/by_time?from=2018-01-01&to=2018-06-30&time=week</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span>GET /api/stats/admin/by_time?from=2018-01-01&to=2018-06-30&time=week HTTP/1.1 # noqa
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p><strong>Example responses</strong>:</p>
|
<p><strong>Example responses</strong>:</p>
|
||||||
@ -293,7 +293,7 @@
|
|||||||
<dt class="field-odd">Parameters</dt>
|
<dt class="field-odd">Parameters</dt>
|
||||||
<dd class="field-odd"><ul class="simple">
|
<dd class="field-odd"><ul class="simple">
|
||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
|
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
|
||||||
<li><p><strong>user_id</strong> (<em>integer</em>) – user id</p></li>
|
<li><p><strong>user_name</strong> (<em>integer</em>) – user name</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
<dt class="field-even">Query Parameters</dt>
|
<dt class="field-even">Query Parameters</dt>
|
||||||
|
@ -197,12 +197,12 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="api/stats.html#get--api-stats-(int-user_id)-by_sport"><code class="xref">GET /api/stats/(int:user_id)/by_sport</code></a></td><td>
|
<a href="api/stats.html#get--api-stats-(user_name)-by_sport"><code class="xref">GET /api/stats/(user_name)/by_sport</code></a></td><td>
|
||||||
<em></em></td></tr>
|
<em></em></td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="api/stats.html#get--api-stats-(int-user_id)-by_time"><code class="xref">GET /api/stats/(int:user_id)/by_time</code></a></td><td>
|
<a href="api/stats.html#get--api-stats-(user_name)-by_time"><code class="xref">GET /api/stats/(user_name)/by_time</code></a></td><td>
|
||||||
<em></em></td></tr>
|
<em></em></td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
BIN
docs/objects.inv
BIN
docs/objects.inv
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -91,7 +91,7 @@ def get_activities(auth_user_id):
|
|||||||
"id": 4,
|
"id": 4,
|
||||||
"record_type": "MS",
|
"record_type": "MS",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -100,7 +100,7 @@ def get_activities(auth_user_id):
|
|||||||
"id": 3,
|
"id": 3,
|
||||||
"record_type": "LD",
|
"record_type": "LD",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": "0:17:04"
|
"value": "0:17:04"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@ def get_activities(auth_user_id):
|
|||||||
"id": 2,
|
"id": 2,
|
||||||
"record_type": "FD",
|
"record_type": "FD",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -118,14 +118,14 @@ def get_activities(auth_user_id):
|
|||||||
"id": 1,
|
"id": 1,
|
||||||
"record_type": "AS",
|
"record_type": "AS",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"segments": [],
|
"segments": [],
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"title": null,
|
"title": null,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"weather_end": null,
|
"weather_end": null,
|
||||||
"weather_start": null,
|
"weather_start": null,
|
||||||
"with_gpx": false
|
"with_gpx": false
|
||||||
@ -307,7 +307,7 @@ def get_activity(auth_user_id, activity_id):
|
|||||||
"segments": [],
|
"segments": [],
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"title": "biking on sunday morning",
|
"title": "biking on sunday morning",
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"weather_end": null,
|
"weather_end": null,
|
||||||
"weather_start": null,
|
"weather_start": null,
|
||||||
"with_gpx": false
|
"with_gpx": false
|
||||||
@ -757,7 +757,7 @@ def post_activity(auth_user_id):
|
|||||||
"id": 4,
|
"id": 4,
|
||||||
"record_type": "MS",
|
"record_type": "MS",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -766,7 +766,7 @@ def post_activity(auth_user_id):
|
|||||||
"id": 3,
|
"id": 3,
|
||||||
"record_type": "LD",
|
"record_type": "LD",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": "0:17:04"
|
"value": "0:17:04"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -775,7 +775,7 @@ def post_activity(auth_user_id):
|
|||||||
"id": 2,
|
"id": 2,
|
||||||
"record_type": "FD",
|
"record_type": "FD",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -784,14 +784,14 @@ def post_activity(auth_user_id):
|
|||||||
"id": 1,
|
"id": 1,
|
||||||
"record_type": "AS",
|
"record_type": "AS",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"segments": [],
|
"segments": [],
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"title": null,
|
"title": null,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"weather_end": null,
|
"weather_end": null,
|
||||||
"weather_start": null,
|
"weather_start": null,
|
||||||
"with_gpx": false
|
"with_gpx": false
|
||||||
@ -922,7 +922,7 @@ def post_activity_no_gpx(auth_user_id):
|
|||||||
"id": 4,
|
"id": 4,
|
||||||
"record_type": "MS",
|
"record_type": "MS",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -931,7 +931,7 @@ def post_activity_no_gpx(auth_user_id):
|
|||||||
"id": 3,
|
"id": 3,
|
||||||
"record_type": "LD",
|
"record_type": "LD",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": "0:17:04"
|
"value": "0:17:04"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -940,7 +940,7 @@ def post_activity_no_gpx(auth_user_id):
|
|||||||
"id": 2,
|
"id": 2,
|
||||||
"record_type": "FD",
|
"record_type": "FD",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -949,14 +949,14 @@ def post_activity_no_gpx(auth_user_id):
|
|||||||
"id": 1,
|
"id": 1,
|
||||||
"record_type": "AS",
|
"record_type": "AS",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"segments": [],
|
"segments": [],
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"title": null,
|
"title": null,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"weather_end": null,
|
"weather_end": null,
|
||||||
"weather_start": null,
|
"weather_start": null,
|
||||||
"with_gpx": false
|
"with_gpx": false
|
||||||
@ -1069,7 +1069,7 @@ def update_activity(auth_user_id, activity_id):
|
|||||||
"id": 4,
|
"id": 4,
|
||||||
"record_type": "MS",
|
"record_type": "MS",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1078,7 +1078,7 @@ def update_activity(auth_user_id, activity_id):
|
|||||||
"id": 3,
|
"id": 3,
|
||||||
"record_type": "LD",
|
"record_type": "LD",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": "0:17:04"
|
"value": "0:17:04"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1087,7 +1087,7 @@ def update_activity(auth_user_id, activity_id):
|
|||||||
"id": 2,
|
"id": 2,
|
||||||
"record_type": "FD",
|
"record_type": "FD",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1096,14 +1096,14 @@ def update_activity(auth_user_id, activity_id):
|
|||||||
"id": 1,
|
"id": 1,
|
||||||
"record_type": "AS",
|
"record_type": "AS",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 10.0
|
"value": 10.0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"segments": [],
|
"segments": [],
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"title": null,
|
"title": null,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"weather_end": null,
|
"weather_end": null,
|
||||||
"weather_start": null,
|
"weather_start": null,
|
||||||
"with_gpx": false
|
"with_gpx": false
|
||||||
|
@ -227,7 +227,7 @@ class Activity(db.Model):
|
|||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
"id": self.id,
|
"id": self.id,
|
||||||
"user_id": self.user_id,
|
"user": self.user.username,
|
||||||
"sport_id": self.sport_id,
|
"sport_id": self.sport_id,
|
||||||
"title": self.title,
|
"title": self.title,
|
||||||
"creation_date": self.creation_date,
|
"creation_date": self.creation_date,
|
||||||
@ -424,7 +424,7 @@ class Record(db.Model):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
"id": self.id,
|
"id": self.id,
|
||||||
"user_id": self.user_id,
|
"user": self.user.username,
|
||||||
"sport_id": self.sport_id,
|
"sport_id": self.sport_id,
|
||||||
"activity_id": self.activity_id,
|
"activity_id": self.activity_id,
|
||||||
"record_type": self.record_type,
|
"record_type": self.record_type,
|
||||||
|
@ -43,7 +43,7 @@ def get_records(auth_user_id):
|
|||||||
"id": 9,
|
"id": 9,
|
||||||
"record_type": "AS",
|
"record_type": "AS",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 18
|
"value": 18
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ def get_records(auth_user_id):
|
|||||||
"id": 10,
|
"id": 10,
|
||||||
"record_type": "FD",
|
"record_type": "FD",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 18
|
"value": 18
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -61,7 +61,7 @@ def get_records(auth_user_id):
|
|||||||
"id": 11,
|
"id": 11,
|
||||||
"record_type": "LD",
|
"record_type": "LD",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": "1:01:00"
|
"value": "1:01:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ def get_records(auth_user_id):
|
|||||||
"id": 12,
|
"id": 12,
|
||||||
"record_type": "MS",
|
"record_type": "MS",
|
||||||
"sport_id": 1,
|
"sport_id": 1,
|
||||||
"user_id": 1,
|
"user": "admin",
|
||||||
"value": 18
|
"value": 18
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -13,9 +13,9 @@ from .utils_format import convert_timedelta_to_integer
|
|||||||
stats_blueprint = Blueprint('stats', __name__)
|
stats_blueprint = Blueprint('stats', __name__)
|
||||||
|
|
||||||
|
|
||||||
def get_activities(user_id, filter_type):
|
def get_activities(user_name, filter_type):
|
||||||
try:
|
try:
|
||||||
user = User.query.filter_by(id=user_id).first()
|
user = User.query.filter_by(username=user_name).first()
|
||||||
if not user:
|
if not user:
|
||||||
response_object = {
|
response_object = {
|
||||||
'status': 'not found',
|
'status': 'not found',
|
||||||
@ -50,7 +50,7 @@ def get_activities(user_id, filter_type):
|
|||||||
|
|
||||||
activities = (
|
activities = (
|
||||||
Activity.query.filter(
|
Activity.query.filter(
|
||||||
Activity.user_id == user_id,
|
Activity.user_id == user.id,
|
||||||
Activity.activity_date >= date_from if date_from else True,
|
Activity.activity_date >= date_from if date_from else True,
|
||||||
Activity.activity_date < date_to + timedelta(seconds=1)
|
Activity.activity_date < date_to + timedelta(seconds=1)
|
||||||
if date_to
|
if date_to
|
||||||
@ -97,11 +97,11 @@ def get_activities(user_id, filter_type):
|
|||||||
elif time == 'month':
|
elif time == 'month':
|
||||||
time_period = datetime.strftime(
|
time_period = datetime.strftime(
|
||||||
activity.activity_date, "%Y-%m"
|
activity.activity_date, "%Y-%m"
|
||||||
) # noqa
|
)
|
||||||
elif time == 'year' or not time:
|
elif time == 'year' or not time:
|
||||||
time_period = datetime.strftime(
|
time_period = datetime.strftime(
|
||||||
activity.activity_date, "%Y"
|
activity.activity_date, "%Y"
|
||||||
) # noqa
|
)
|
||||||
else:
|
else:
|
||||||
response_object = {
|
response_object = {
|
||||||
'status': 'fail',
|
'status': 'fail',
|
||||||
@ -140,9 +140,9 @@ def get_activities(user_id, filter_type):
|
|||||||
return jsonify(response_object), code
|
return jsonify(response_object), code
|
||||||
|
|
||||||
|
|
||||||
@stats_blueprint.route('/stats/<int:user_id>/by_time', methods=['GET'])
|
@stats_blueprint.route('/stats/<user_name>/by_time', methods=['GET'])
|
||||||
@authenticate
|
@authenticate
|
||||||
def get_activities_by_time(auth_user_id, user_id):
|
def get_activities_by_time(auth_user_id, user_name):
|
||||||
"""
|
"""
|
||||||
Get activities statistics for a user by time
|
Get activities statistics for a user by time
|
||||||
|
|
||||||
@ -152,13 +152,13 @@ def get_activities_by_time(auth_user_id, user_id):
|
|||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
|
|
||||||
GET /api/stats/1/by_time HTTP/1.1
|
GET /api/stats/admin/by_time HTTP/1.1
|
||||||
|
|
||||||
- with parameters
|
- with parameters
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
|
|
||||||
GET /api/stats/1/by_time?from=2018-01-01&to=2018-06-30&time=week HTTP/1.1
|
GET /api/stats/admin/by_time?from=2018-01-01&to=2018-06-30&time=week HTTP/1.1 # noqa
|
||||||
|
|
||||||
**Example responses**:
|
**Example responses**:
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ def get_activities_by_time(auth_user_id, user_id):
|
|||||||
}
|
}
|
||||||
|
|
||||||
:param integer auth_user_id: authenticate user id (from JSON Web Token)
|
:param integer auth_user_id: authenticate user id (from JSON Web Token)
|
||||||
:param integer user_id: user id
|
:param integer user_name: user name
|
||||||
|
|
||||||
:query string from: start date (format: ``%Y-%m-%d``)
|
:query string from: start date (format: ``%Y-%m-%d``)
|
||||||
:query string to: end date (format: ``%Y-%m-%d``)
|
:query string to: end date (format: ``%Y-%m-%d``)
|
||||||
@ -233,12 +233,12 @@ def get_activities_by_time(auth_user_id, user_id):
|
|||||||
- User does not exist.
|
- User does not exist.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return get_activities(user_id, 'by_time')
|
return get_activities(user_name, 'by_time')
|
||||||
|
|
||||||
|
|
||||||
@stats_blueprint.route('/stats/<int:user_id>/by_sport', methods=['GET'])
|
@stats_blueprint.route('/stats/<user_name>/by_sport', methods=['GET'])
|
||||||
@authenticate
|
@authenticate
|
||||||
def get_activities_by_sport(auth_user_id, user_id):
|
def get_activities_by_sport(auth_user_id, user_name):
|
||||||
"""
|
"""
|
||||||
Get activities statistics for a user by sport
|
Get activities statistics for a user by sport
|
||||||
|
|
||||||
@ -248,13 +248,13 @@ def get_activities_by_sport(auth_user_id, user_id):
|
|||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
|
|
||||||
GET /api/stats/1/by_sport HTTP/1.1
|
GET /api/stats/admin/by_sport HTTP/1.1
|
||||||
|
|
||||||
- with sport id
|
- with sport id
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
|
|
||||||
GET /api/stats/1/by_sport?sport_id=1 HTTP/1.1
|
GET /api/stats/admin/by_sport?sport_id=1 HTTP/1.1
|
||||||
|
|
||||||
**Example responses**:
|
**Example responses**:
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ def get_activities_by_sport(auth_user_id, user_id):
|
|||||||
}
|
}
|
||||||
|
|
||||||
:param integer auth_user_id: authenticate user id (from JSON Web Token)
|
:param integer auth_user_id: authenticate user id (from JSON Web Token)
|
||||||
:param integer user_id: user id
|
:param integer user_name: user name
|
||||||
|
|
||||||
:query integer sport_id: sport id
|
:query integer sport_id: sport id
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ def get_activities_by_sport(auth_user_id, user_id):
|
|||||||
- Sport does not exist.
|
- Sport does not exist.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return get_activities(user_id, 'by_sport')
|
return get_activities(user_name, 'by_sport')
|
||||||
|
|
||||||
|
|
||||||
@stats_blueprint.route('/stats/all', methods=['GET'])
|
@stats_blueprint.route('/stats/all', methods=['GET'])
|
||||||
|
@ -35,8 +35,8 @@ def test_get_all_activities_for_authenticated_user(
|
|||||||
assert (
|
assert (
|
||||||
'Sun, 01 Apr 2018 00:00:00 GMT'
|
'Sun, 01 Apr 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert 1 == data['data']['activities'][0]['user_id']
|
assert 'test' == data['data']['activities'][0]['user']
|
||||||
assert 2 == data['data']['activities'][0]['sport_id']
|
assert 2 == data['data']['activities'][0]['sport_id']
|
||||||
assert 12.0 == data['data']['activities'][0]['distance']
|
assert 12.0 == data['data']['activities'][0]['distance']
|
||||||
assert '1:40:00' == data['data']['activities'][0]['duration']
|
assert '1:40:00' == data['data']['activities'][0]['duration']
|
||||||
@ -45,8 +45,8 @@ def test_get_all_activities_for_authenticated_user(
|
|||||||
assert (
|
assert (
|
||||||
'Mon, 01 Jan 2018 00:00:00 GMT'
|
'Mon, 01 Jan 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][1]['activity_date']
|
== data['data']['activities'][1]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert 1 == data['data']['activities'][1]['user_id']
|
assert 'test' == data['data']['activities'][1]['user']
|
||||||
assert 1 == data['data']['activities'][1]['sport_id']
|
assert 1 == data['data']['activities'][1]['sport_id']
|
||||||
assert 10.0 == data['data']['activities'][1]['distance']
|
assert 10.0 == data['data']['activities'][1]['distance']
|
||||||
assert '0:17:04' == data['data']['activities'][1]['duration']
|
assert '0:17:04' == data['data']['activities'][1]['duration']
|
||||||
@ -116,13 +116,13 @@ def test_get_activities_pagination(
|
|||||||
assert (
|
assert (
|
||||||
'Wed, 09 May 2018 00:00:00 GMT'
|
'Wed, 09 May 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert '0:50:00' == data['data']['activities'][0]['duration']
|
assert '0:50:00' == data['data']['activities'][0]['duration']
|
||||||
assert 'creation_date' in data['data']['activities'][4]
|
assert 'creation_date' in data['data']['activities'][4]
|
||||||
assert (
|
assert (
|
||||||
'Mon, 01 Jan 2018 00:00:00 GMT'
|
'Mon, 01 Jan 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][4]['activity_date']
|
== data['data']['activities'][4]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert '0:17:04' == data['data']['activities'][4]['duration']
|
assert '0:17:04' == data['data']['activities'][4]['duration']
|
||||||
|
|
||||||
response = client.get(
|
response = client.get(
|
||||||
@ -141,13 +141,13 @@ def test_get_activities_pagination(
|
|||||||
assert (
|
assert (
|
||||||
'Wed, 09 May 2018 00:00:00 GMT'
|
'Wed, 09 May 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert '0:50:00' == data['data']['activities'][0]['duration']
|
assert '0:50:00' == data['data']['activities'][0]['duration']
|
||||||
assert 'creation_date' in data['data']['activities'][4]
|
assert 'creation_date' in data['data']['activities'][4]
|
||||||
assert (
|
assert (
|
||||||
'Mon, 01 Jan 2018 00:00:00 GMT'
|
'Mon, 01 Jan 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][4]['activity_date']
|
== data['data']['activities'][4]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert '0:17:04' == data['data']['activities'][4]['duration']
|
assert '0:17:04' == data['data']['activities'][4]['duration']
|
||||||
|
|
||||||
response = client.get(
|
response = client.get(
|
||||||
@ -166,13 +166,13 @@ def test_get_activities_pagination(
|
|||||||
assert (
|
assert (
|
||||||
'Thu, 01 Jun 2017 00:00:00 GMT'
|
'Thu, 01 Jun 2017 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert '0:57:36' == data['data']['activities'][0]['duration']
|
assert '0:57:36' == data['data']['activities'][0]['duration']
|
||||||
assert 'creation_date' in data['data']['activities'][1]
|
assert 'creation_date' in data['data']['activities'][1]
|
||||||
assert (
|
assert (
|
||||||
'Mon, 20 Mar 2017 00:00:00 GMT'
|
'Mon, 20 Mar 2017 00:00:00 GMT'
|
||||||
== data['data']['activities'][1]['activity_date']
|
== data['data']['activities'][1]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert '0:17:04' == data['data']['activities'][1]['duration']
|
assert '0:17:04' == data['data']['activities'][1]['duration']
|
||||||
|
|
||||||
response = client.get(
|
response = client.get(
|
||||||
@ -212,7 +212,7 @@ def test_get_activities_pagination_error(
|
|||||||
assert (
|
assert (
|
||||||
'Error. Please try again or contact the administrator.'
|
'Error. Please try again or contact the administrator.'
|
||||||
in data['message']
|
in data['message']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_date_filter(
|
def test_get_activities_date_filter(
|
||||||
@ -240,13 +240,13 @@ def test_get_activities_date_filter(
|
|||||||
assert (
|
assert (
|
||||||
'Fri, 23 Feb 2018 00:00:00 GMT'
|
'Fri, 23 Feb 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert '0:10:00' == data['data']['activities'][0]['duration']
|
assert '0:10:00' == data['data']['activities'][0]['duration']
|
||||||
assert 'creation_date' in data['data']['activities'][1]
|
assert 'creation_date' in data['data']['activities'][1]
|
||||||
assert (
|
assert (
|
||||||
'Fri, 23 Feb 2018 00:00:00 GMT'
|
'Fri, 23 Feb 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][1]['activity_date']
|
== data['data']['activities'][1]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert '0:16:40' == data['data']['activities'][1]['duration']
|
assert '0:16:40' == data['data']['activities'][1]['duration']
|
||||||
|
|
||||||
|
|
||||||
@ -298,11 +298,11 @@ def test_get_activities_date_filter_from(
|
|||||||
assert (
|
assert (
|
||||||
'Wed, 09 May 2018 00:00:00 GMT'
|
'Wed, 09 May 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
'Sun, 01 Apr 2018 00:00:00 GMT'
|
'Sun, 01 Apr 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][1]['activity_date']
|
== data['data']['activities'][1]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_date_filter_to(
|
def test_get_activities_date_filter_to(
|
||||||
@ -329,11 +329,11 @@ def test_get_activities_date_filter_to(
|
|||||||
assert (
|
assert (
|
||||||
'Thu, 01 Jun 2017 00:00:00 GMT'
|
'Thu, 01 Jun 2017 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
'Mon, 20 Mar 2017 00:00:00 GMT'
|
'Mon, 20 Mar 2017 00:00:00 GMT'
|
||||||
== data['data']['activities'][1]['activity_date']
|
== data['data']['activities'][1]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_date_filter_paginate(
|
def test_get_activities_date_filter_paginate(
|
||||||
@ -360,11 +360,11 @@ def test_get_activities_date_filter_paginate(
|
|||||||
assert (
|
assert (
|
||||||
'Thu, 01 Jun 2017 00:00:00 GMT'
|
'Thu, 01 Jun 2017 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
'Mon, 20 Mar 2017 00:00:00 GMT'
|
'Mon, 20 Mar 2017 00:00:00 GMT'
|
||||||
== data['data']['activities'][1]['activity_date']
|
== data['data']['activities'][1]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_order(
|
def test_get_activities_order(
|
||||||
@ -391,11 +391,11 @@ def test_get_activities_order(
|
|||||||
assert (
|
assert (
|
||||||
'Mon, 20 Mar 2017 00:00:00 GMT'
|
'Mon, 20 Mar 2017 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
'Fri, 23 Feb 2018 00:00:00 GMT'
|
'Fri, 23 Feb 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][4]['activity_date']
|
== data['data']['activities'][4]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_date_filter_paginate_order(
|
def test_get_activities_date_filter_paginate_order(
|
||||||
@ -422,11 +422,11 @@ def test_get_activities_date_filter_paginate_order(
|
|||||||
assert (
|
assert (
|
||||||
'Sun, 01 Apr 2018 00:00:00 GMT'
|
'Sun, 01 Apr 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
'Wed, 09 May 2018 00:00:00 GMT'
|
'Wed, 09 May 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][1]['activity_date']
|
== data['data']['activities'][1]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_distance_filter(
|
def test_get_activities_distance_filter(
|
||||||
@ -453,11 +453,11 @@ def test_get_activities_distance_filter(
|
|||||||
assert (
|
assert (
|
||||||
'Sun, 01 Apr 2018 00:00:00 GMT'
|
'Sun, 01 Apr 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
'Mon, 20 Mar 2017 00:00:00 GMT'
|
'Mon, 20 Mar 2017 00:00:00 GMT'
|
||||||
== data['data']['activities'][1]['activity_date']
|
== data['data']['activities'][1]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_duration_filter(
|
def test_get_activities_duration_filter(
|
||||||
@ -484,7 +484,7 @@ def test_get_activities_duration_filter(
|
|||||||
assert (
|
assert (
|
||||||
'Thu, 01 Jun 2017 00:00:00 GMT'
|
'Thu, 01 Jun 2017 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_ave_speed_filter(
|
def test_get_activities_ave_speed_filter(
|
||||||
@ -511,7 +511,7 @@ def test_get_activities_ave_speed_filter(
|
|||||||
assert (
|
assert (
|
||||||
'Fri, 23 Feb 2018 00:00:00 GMT'
|
'Fri, 23 Feb 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_max_speed_filter(
|
def test_get_activities_max_speed_filter(
|
||||||
@ -545,7 +545,7 @@ def test_get_activities_max_speed_filter(
|
|||||||
assert (
|
assert (
|
||||||
'Sun, 01 Apr 2018 00:00:00 GMT'
|
'Sun, 01 Apr 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_sport_filter(
|
def test_get_activities_sport_filter(
|
||||||
@ -577,7 +577,7 @@ def test_get_activities_sport_filter(
|
|||||||
assert (
|
assert (
|
||||||
'Sun, 01 Apr 2018 00:00:00 GMT'
|
'Sun, 01 Apr 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_an_activity(
|
def test_get_an_activity(
|
||||||
@ -607,8 +607,8 @@ def test_get_an_activity(
|
|||||||
assert (
|
assert (
|
||||||
'Mon, 01 Jan 2018 00:00:00 GMT'
|
'Mon, 01 Jan 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert 1 == data['data']['activities'][0]['user_id']
|
assert 'test' == data['data']['activities'][0]['user']
|
||||||
assert 1 == data['data']['activities'][0]['sport_id']
|
assert 1 == data['data']['activities'][0]['sport_id']
|
||||||
assert 10.0 == data['data']['activities'][0]['distance']
|
assert 10.0 == data['data']['activities'][0]['distance']
|
||||||
assert '0:17:04' == data['data']['activities'][0]['duration']
|
assert '0:17:04' == data['data']['activities'][0]['duration']
|
||||||
@ -662,11 +662,11 @@ def test_get_activities_per_page(
|
|||||||
assert (
|
assert (
|
||||||
'Wed, 09 May 2018 00:00:00 GMT'
|
'Wed, 09 May 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
'Mon, 20 Mar 2017 00:00:00 GMT'
|
'Mon, 20 Mar 2017 00:00:00 GMT'
|
||||||
== data['data']['activities'][6]['activity_date']
|
== data['data']['activities'][6]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
response = client.get(
|
response = client.get(
|
||||||
'/api/activities?per_page=3',
|
'/api/activities?per_page=3',
|
||||||
@ -683,11 +683,11 @@ def test_get_activities_per_page(
|
|||||||
assert (
|
assert (
|
||||||
'Wed, 09 May 2018 00:00:00 GMT'
|
'Wed, 09 May 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
'Fri, 23 Feb 2018 00:00:00 GMT'
|
'Fri, 23 Feb 2018 00:00:00 GMT'
|
||||||
== data['data']['activities'][2]['activity_date']
|
== data['data']['activities'][2]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_an_activity_invalid_id(app, user_1):
|
def test_get_an_activity_invalid_id(app, user_1):
|
||||||
|
@ -11,8 +11,8 @@ def assert_activity_data_with_gpx(data):
|
|||||||
assert (
|
assert (
|
||||||
'Tue, 13 Mar 2018 12:44:45 GMT'
|
'Tue, 13 Mar 2018 12:44:45 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert 1 == data['data']['activities'][0]['user_id']
|
assert 'test' == data['data']['activities'][0]['user']
|
||||||
assert 1 == data['data']['activities'][0]['sport_id']
|
assert 1 == data['data']['activities'][0]['sport_id']
|
||||||
assert '0:04:10' == data['data']['activities'][0]['duration']
|
assert '0:04:10' == data['data']['activities'][0]['duration']
|
||||||
assert data['data']['activities'][0]['ascent'] == 0.4
|
assert data['data']['activities'][0]['ascent'] == 0.4
|
||||||
@ -74,8 +74,8 @@ def assert_activity_data_with_gpx_segments(data):
|
|||||||
assert (
|
assert (
|
||||||
'Tue, 13 Mar 2018 12:44:45 GMT'
|
'Tue, 13 Mar 2018 12:44:45 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert 1 == data['data']['activities'][0]['user_id']
|
assert 'test' == data['data']['activities'][0]['user']
|
||||||
assert 1 == data['data']['activities'][0]['sport_id']
|
assert 1 == data['data']['activities'][0]['sport_id']
|
||||||
assert '0:04:10' == data['data']['activities'][0]['duration']
|
assert '0:04:10' == data['data']['activities'][0]['duration']
|
||||||
assert data['data']['activities'][0]['ascent'] == 0.4
|
assert data['data']['activities'][0]['ascent'] == 0.4
|
||||||
@ -148,14 +148,14 @@ def assert_activity_data_wo_gpx(data):
|
|||||||
assert (
|
assert (
|
||||||
data['data']['activities'][0]['activity_date']
|
data['data']['activities'][0]['activity_date']
|
||||||
== 'Tue, 15 May 2018 14:05:00 GMT'
|
== 'Tue, 15 May 2018 14:05:00 GMT'
|
||||||
) # noqa
|
)
|
||||||
assert data['data']['activities'][0]['user_id'] == 1
|
assert data['data']['activities'][0]['user'] == 'test'
|
||||||
assert data['data']['activities'][0]['sport_id'] == 1
|
assert data['data']['activities'][0]['sport_id'] == 1
|
||||||
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
||||||
assert (
|
assert (
|
||||||
data['data']['activities'][0]['title']
|
data['data']['activities'][0]['title']
|
||||||
== 'Cycling - 2018-05-15 14:05:00'
|
== 'Cycling - 2018-05-15 14:05:00'
|
||||||
) # noqa
|
)
|
||||||
assert data['data']['activities'][0]['ascent'] is None
|
assert data['data']['activities'][0]['ascent'] is None
|
||||||
assert data['data']['activities'][0]['ave_speed'] == 10.0
|
assert data['data']['activities'][0]['ave_speed'] == 10.0
|
||||||
assert data['data']['activities'][0]['descent'] is None
|
assert data['data']['activities'][0]['descent'] is None
|
||||||
@ -562,7 +562,7 @@ def test_add_an_activity_with_gpx_without_name(
|
|||||||
assert (
|
assert (
|
||||||
'Cycling - 2018-03-13 12:44:45'
|
'Cycling - 2018-03-13 12:44:45'
|
||||||
== data['data']['activities'][0]['title']
|
== data['data']['activities'][0]['title']
|
||||||
) # noqa
|
)
|
||||||
assert_activity_data_with_gpx(data)
|
assert_activity_data_with_gpx(data)
|
||||||
|
|
||||||
|
|
||||||
@ -596,7 +596,7 @@ def test_add_an_activity_with_gpx_without_name_timezone(
|
|||||||
assert (
|
assert (
|
||||||
'Cycling - 2018-03-13 13:44:45'
|
'Cycling - 2018-03-13 13:44:45'
|
||||||
== data['data']['activities'][0]['title']
|
== data['data']['activities'][0]['title']
|
||||||
) # noqa
|
)
|
||||||
assert_activity_data_with_gpx(data)
|
assert_activity_data_with_gpx(data)
|
||||||
|
|
||||||
|
|
||||||
@ -948,11 +948,11 @@ def test_get_an_activity_wo_gpx_with_timezone(app, user_1, sport_1_cycling):
|
|||||||
assert (
|
assert (
|
||||||
data['data']['activities'][0]['activity_date']
|
data['data']['activities'][0]['activity_date']
|
||||||
== 'Tue, 15 May 2018 12:05:00 GMT'
|
== 'Tue, 15 May 2018 12:05:00 GMT'
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
data['data']['activities'][0]['title']
|
data['data']['activities'][0]['title']
|
||||||
== 'Cycling - 2018-05-15 14:05:00'
|
== 'Cycling - 2018-05-15 14:05:00'
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_date_filter_with_timezone_new_york(
|
def test_get_activities_date_filter_with_timezone_new_york(
|
||||||
@ -995,11 +995,11 @@ def test_get_activities_date_filter_with_timezone_new_york(
|
|||||||
assert (
|
assert (
|
||||||
'Mon, 01 Jan 2018 05:00:00 GMT'
|
'Mon, 01 Jan 2018 05:00:00 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
'Cycling - 2018-01-01 00:00:00'
|
'Cycling - 2018-01-01 00:00:00'
|
||||||
== data['data']['activities'][0]['title']
|
== data['data']['activities'][0]['title']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_get_activities_date_filter_with_timezone_paris(
|
def test_get_activities_date_filter_with_timezone_paris(
|
||||||
@ -1080,16 +1080,16 @@ def test_get_activities_date_filter_with_timezone_paris(
|
|||||||
assert (
|
assert (
|
||||||
'Wed, 31 Jan 2018 21:59:59 GMT'
|
'Wed, 31 Jan 2018 21:59:59 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert 'Test' == data['data']['activities'][0]['title']
|
assert 'Test' == data['data']['activities'][0]['title']
|
||||||
assert (
|
assert (
|
||||||
'Sun, 31 Dec 2017 23:00:00 GMT'
|
'Sun, 31 Dec 2017 23:00:00 GMT'
|
||||||
== data['data']['activities'][1]['activity_date']
|
== data['data']['activities'][1]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert (
|
assert (
|
||||||
'Cycling - 2018-01-01 00:00:00'
|
'Cycling - 2018-01-01 00:00:00'
|
||||||
== data['data']['activities'][1]['title']
|
== data['data']['activities'][1]['title']
|
||||||
) # noqa
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_add_an_activity_no_gpx_invalid_payload(app, user_1, sport_1_cycling):
|
def test_add_an_activity_no_gpx_invalid_payload(app, user_1, sport_1_cycling):
|
||||||
@ -1177,8 +1177,8 @@ def test_add_activity_zero_value(
|
|||||||
assert (
|
assert (
|
||||||
data['data']['activities'][0]['activity_date']
|
data['data']['activities'][0]['activity_date']
|
||||||
== 'Mon, 14 May 2018 14:05:00 GMT'
|
== 'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
) # noqa
|
)
|
||||||
assert data['data']['activities'][0]['user_id'] == 1
|
assert data['data']['activities'][0]['user'] == 'test'
|
||||||
assert data['data']['activities'][0]['sport_id'] == 1
|
assert data['data']['activities'][0]['sport_id'] == 1
|
||||||
assert data['data']['activities'][0]['duration'] is None
|
assert data['data']['activities'][0]['duration'] is None
|
||||||
assert data['data']['activities'][0]['title'] == 'Activity test' # noqa
|
assert data['data']['activities'][0]['title'] == 'Activity test' # noqa
|
||||||
@ -1259,7 +1259,7 @@ def test_get_an_activity_with_zip_folder(app, user_1, sport_1_cycling):
|
|||||||
def test_get_an_activity_with_zip_incorrect_file(app, user_1, sport_1_cycling):
|
def test_get_an_activity_with_zip_incorrect_file(app, user_1, sport_1_cycling):
|
||||||
file_path = os.path.join(
|
file_path = os.path.join(
|
||||||
app.root_path, 'tests/files/gpx_test_incorrect.zip'
|
app.root_path, 'tests/files/gpx_test_incorrect.zip'
|
||||||
) # noqa
|
)
|
||||||
# 'gpx_test_incorrect.zip' contains 2 gpx files, one is incorrect
|
# 'gpx_test_incorrect.zip' contains 2 gpx files, one is incorrect
|
||||||
|
|
||||||
with open(file_path, 'rb') as zip_file:
|
with open(file_path, 'rb') as zip_file:
|
||||||
|
@ -10,7 +10,7 @@ def assert_activity_data_with_gpx(data):
|
|||||||
'Tue, 13 Mar 2018 12:44:45 GMT'
|
'Tue, 13 Mar 2018 12:44:45 GMT'
|
||||||
== data['data']['activities'][0]['activity_date']
|
== data['data']['activities'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['activities'][0]['user_id']
|
assert 'test' == data['data']['activities'][0]['user']
|
||||||
assert '0:04:10' == data['data']['activities'][0]['duration']
|
assert '0:04:10' == data['data']['activities'][0]['duration']
|
||||||
assert data['data']['activities'][0]['ascent'] == 0.4
|
assert data['data']['activities'][0]['ascent'] == 0.4
|
||||||
assert data['data']['activities'][0]['ave_speed'] == 4.61
|
assert data['data']['activities'][0]['ave_speed'] == 4.61
|
||||||
@ -303,7 +303,7 @@ def test_edit_an_activity_wo_gpx(
|
|||||||
data['data']['activities'][0]['activity_date']
|
data['data']['activities'][0]['activity_date']
|
||||||
== 'Mon, 14 May 2018 14:05:00 GMT'
|
== 'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
) # noqa
|
) # noqa
|
||||||
assert data['data']['activities'][0]['user_id'] == 1
|
assert data['data']['activities'][0]['user'] == 'test'
|
||||||
assert data['data']['activities'][0]['sport_id'] == 1
|
assert data['data']['activities'][0]['sport_id'] == 1
|
||||||
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
||||||
assert data['data']['activities'][0]['title'] == 'Activity test' # noqa
|
assert data['data']['activities'][0]['title'] == 'Activity test' # noqa
|
||||||
@ -372,7 +372,7 @@ def test_edit_an_activity_wo_gpx(
|
|||||||
data['data']['activities'][0]['activity_date']
|
data['data']['activities'][0]['activity_date']
|
||||||
== 'Tue, 15 May 2018 15:05:00 GMT'
|
== 'Tue, 15 May 2018 15:05:00 GMT'
|
||||||
) # noqa
|
) # noqa
|
||||||
assert data['data']['activities'][0]['user_id'] == 1
|
assert data['data']['activities'][0]['user'] == 'test'
|
||||||
assert data['data']['activities'][0]['sport_id'] == 2
|
assert data['data']['activities'][0]['sport_id'] == 2
|
||||||
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
||||||
assert data['data']['activities'][0]['title'] == 'Activity test'
|
assert data['data']['activities'][0]['title'] == 'Activity test'
|
||||||
@ -433,7 +433,7 @@ def test_edit_an_activity_wo_gpx(
|
|||||||
data['data']['activities'][0]['activity_date']
|
data['data']['activities'][0]['activity_date']
|
||||||
== 'Tue, 15 May 2018 15:05:00 GMT'
|
== 'Tue, 15 May 2018 15:05:00 GMT'
|
||||||
) # noqa
|
) # noqa
|
||||||
assert data['data']['activities'][0]['user_id'] == 1
|
assert data['data']['activities'][0]['user'] == 'test'
|
||||||
assert data['data']['activities'][0]['sport_id'] == 2
|
assert data['data']['activities'][0]['sport_id'] == 2
|
||||||
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
||||||
assert data['data']['activities'][0]['title'] == 'Activity test'
|
assert data['data']['activities'][0]['title'] == 'Activity test'
|
||||||
@ -569,7 +569,7 @@ def test_edit_an_activity_wo_gpx_timezone(
|
|||||||
data['data']['activities'][0]['activity_date']
|
data['data']['activities'][0]['activity_date']
|
||||||
== 'Mon, 14 May 2018 12:05:00 GMT'
|
== 'Mon, 14 May 2018 12:05:00 GMT'
|
||||||
) # noqa
|
) # noqa
|
||||||
assert data['data']['activities'][0]['user_id'] == 1
|
assert data['data']['activities'][0]['user'] == 'test'
|
||||||
assert data['data']['activities'][0]['sport_id'] == 1
|
assert data['data']['activities'][0]['sport_id'] == 1
|
||||||
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
||||||
assert (
|
assert (
|
||||||
@ -637,7 +637,7 @@ def test_edit_an_activity_wo_gpx_timezone(
|
|||||||
data['data']['activities'][0]['activity_date']
|
data['data']['activities'][0]['activity_date']
|
||||||
== 'Tue, 15 May 2018 13:05:00 GMT'
|
== 'Tue, 15 May 2018 13:05:00 GMT'
|
||||||
) # noqa
|
) # noqa
|
||||||
assert data['data']['activities'][0]['user_id'] == 1
|
assert data['data']['activities'][0]['user'] == 'test'
|
||||||
assert data['data']['activities'][0]['sport_id'] == 2
|
assert data['data']['activities'][0]['sport_id'] == 2
|
||||||
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
||||||
assert data['data']['activities'][0]['title'] == 'Activity test' # noqa
|
assert data['data']['activities'][0]['title'] == 'Activity test' # noqa
|
||||||
@ -710,7 +710,7 @@ def test_edit_an_activity_wo_gpx_partial(app, user_1, sport_1_cycling):
|
|||||||
data['data']['activities'][0]['activity_date']
|
data['data']['activities'][0]['activity_date']
|
||||||
== 'Mon, 14 May 2018 14:05:00 GMT'
|
== 'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
) # noqa
|
) # noqa
|
||||||
assert data['data']['activities'][0]['user_id'] == 1
|
assert data['data']['activities'][0]['user'] == 'test'
|
||||||
assert data['data']['activities'][0]['sport_id'] == 1
|
assert data['data']['activities'][0]['sport_id'] == 1
|
||||||
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
||||||
assert (
|
assert (
|
||||||
@ -771,7 +771,7 @@ def test_edit_an_activity_wo_gpx_partial(app, user_1, sport_1_cycling):
|
|||||||
data['data']['activities'][0]['activity_date']
|
data['data']['activities'][0]['activity_date']
|
||||||
== 'Mon, 14 May 2018 14:05:00 GMT'
|
== 'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
) # noqa
|
) # noqa
|
||||||
assert data['data']['activities'][0]['user_id'] == 1
|
assert data['data']['activities'][0]['user'] == 'test'
|
||||||
assert data['data']['activities'][0]['sport_id'] == 1
|
assert data['data']['activities'][0]['sport_id'] == 1
|
||||||
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
assert data['data']['activities'][0]['duration'] == '1:00:00'
|
||||||
assert (
|
assert (
|
||||||
|
@ -14,7 +14,7 @@ def test_add_activity(app, sport_1_cycling, user_1, activity_cycling_user_1):
|
|||||||
|
|
||||||
serialized_activity = activity_cycling_user_1.serialize()
|
serialized_activity = activity_cycling_user_1.serialize()
|
||||||
assert 1 == serialized_activity['id']
|
assert 1 == serialized_activity['id']
|
||||||
assert 1 == serialized_activity['user_id']
|
assert 'test' == serialized_activity['user']
|
||||||
assert 1 == serialized_activity['sport_id']
|
assert 1 == serialized_activity['sport_id']
|
||||||
assert serialized_activity['title'] == 'Test'
|
assert serialized_activity['title'] == 'Test'
|
||||||
assert 'creation_date' in serialized_activity
|
assert 'creation_date' in serialized_activity
|
||||||
|
@ -32,8 +32,8 @@ def test_get_records_for_authenticated_user(
|
|||||||
assert (
|
assert (
|
||||||
'Mon, 01 Jan 2018 00:00:00 GMT'
|
'Mon, 01 Jan 2018 00:00:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 1 == data['data']['records'][0]['activity_id']
|
assert 1 == data['data']['records'][0]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][0]['record_type']
|
assert 'AS' == data['data']['records'][0]['record_type']
|
||||||
@ -42,8 +42,8 @@ def test_get_records_for_authenticated_user(
|
|||||||
assert (
|
assert (
|
||||||
'Mon, 01 Jan 2018 00:00:00 GMT'
|
'Mon, 01 Jan 2018 00:00:00 GMT'
|
||||||
== data['data']['records'][1]['activity_date']
|
== data['data']['records'][1]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert 1 == data['data']['records'][1]['user_id']
|
assert 'test' == data['data']['records'][1]['user']
|
||||||
assert 1 == data['data']['records'][1]['sport_id']
|
assert 1 == data['data']['records'][1]['sport_id']
|
||||||
assert 1 == data['data']['records'][1]['activity_id']
|
assert 1 == data['data']['records'][1]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][1]['record_type']
|
assert 'FD' == data['data']['records'][1]['record_type']
|
||||||
@ -52,8 +52,8 @@ def test_get_records_for_authenticated_user(
|
|||||||
assert (
|
assert (
|
||||||
'Mon, 01 Jan 2018 00:00:00 GMT'
|
'Mon, 01 Jan 2018 00:00:00 GMT'
|
||||||
== data['data']['records'][2]['activity_date']
|
== data['data']['records'][2]['activity_date']
|
||||||
) # noqa
|
)
|
||||||
assert 1 == data['data']['records'][2]['user_id']
|
assert 'test' == data['data']['records'][2]['user']
|
||||||
assert 1 == data['data']['records'][2]['sport_id']
|
assert 1 == data['data']['records'][2]['sport_id']
|
||||||
assert 1 == data['data']['records'][2]['activity_id']
|
assert 1 == data['data']['records'][2]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][2]['record_type']
|
assert 'LD' == data['data']['records'][2]['record_type']
|
||||||
@ -63,7 +63,7 @@ def test_get_records_for_authenticated_user(
|
|||||||
'Mon, 01 Jan 2018 00:00:00 GMT'
|
'Mon, 01 Jan 2018 00:00:00 GMT'
|
||||||
== data['data']['records'][3]['activity_date']
|
== data['data']['records'][3]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][3]['user_id']
|
assert 'test' == data['data']['records'][3]['user']
|
||||||
assert 1 == data['data']['records'][3]['sport_id']
|
assert 1 == data['data']['records'][3]['sport_id']
|
||||||
assert 1 == data['data']['records'][3]['activity_id']
|
assert 1 == data['data']['records'][3]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][3]['record_type']
|
assert 'MS' == data['data']['records'][3]['record_type']
|
||||||
@ -181,7 +181,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 1 == data['data']['records'][0]['activity_id']
|
assert 1 == data['data']['records'][0]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][0]['record_type']
|
assert 'AS' == data['data']['records'][0]['record_type']
|
||||||
@ -191,7 +191,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][1]['activity_date']
|
== data['data']['records'][1]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][1]['user_id']
|
assert 'test' == data['data']['records'][1]['user']
|
||||||
assert 1 == data['data']['records'][1]['sport_id']
|
assert 1 == data['data']['records'][1]['sport_id']
|
||||||
assert 1 == data['data']['records'][1]['activity_id']
|
assert 1 == data['data']['records'][1]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][1]['record_type']
|
assert 'FD' == data['data']['records'][1]['record_type']
|
||||||
@ -201,7 +201,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][2]['activity_date']
|
== data['data']['records'][2]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][2]['user_id']
|
assert 'test' == data['data']['records'][2]['user']
|
||||||
assert 1 == data['data']['records'][2]['sport_id']
|
assert 1 == data['data']['records'][2]['sport_id']
|
||||||
assert 1 == data['data']['records'][2]['activity_id']
|
assert 1 == data['data']['records'][2]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][2]['record_type']
|
assert 'LD' == data['data']['records'][2]['record_type']
|
||||||
@ -211,7 +211,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][3]['activity_date']
|
== data['data']['records'][3]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][3]['user_id']
|
assert 'test' == data['data']['records'][3]['user']
|
||||||
assert 1 == data['data']['records'][3]['sport_id']
|
assert 1 == data['data']['records'][3]['sport_id']
|
||||||
assert 1 == data['data']['records'][3]['activity_id']
|
assert 1 == data['data']['records'][3]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][3]['record_type']
|
assert 'MS' == data['data']['records'][3]['record_type']
|
||||||
@ -253,7 +253,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Tue, 15 May 2018 14:05:00 GMT'
|
'Tue, 15 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 2 == data['data']['records'][0]['activity_id']
|
assert 2 == data['data']['records'][0]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][0]['record_type']
|
assert 'AS' == data['data']['records'][0]['record_type']
|
||||||
@ -263,7 +263,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][1]['activity_date']
|
== data['data']['records'][1]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][1]['user_id']
|
assert 'test' == data['data']['records'][1]['user']
|
||||||
assert 1 == data['data']['records'][1]['sport_id']
|
assert 1 == data['data']['records'][1]['sport_id']
|
||||||
assert 1 == data['data']['records'][1]['activity_id']
|
assert 1 == data['data']['records'][1]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][1]['record_type']
|
assert 'FD' == data['data']['records'][1]['record_type']
|
||||||
@ -273,7 +273,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][2]['activity_date']
|
== data['data']['records'][2]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][2]['user_id']
|
assert 'test' == data['data']['records'][2]['user']
|
||||||
assert 1 == data['data']['records'][2]['sport_id']
|
assert 1 == data['data']['records'][2]['sport_id']
|
||||||
assert 1 == data['data']['records'][2]['activity_id']
|
assert 1 == data['data']['records'][2]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][2]['record_type']
|
assert 'LD' == data['data']['records'][2]['record_type']
|
||||||
@ -283,7 +283,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Tue, 15 May 2018 14:05:00 GMT'
|
'Tue, 15 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 2 == data['data']['records'][0]['activity_id']
|
assert 2 == data['data']['records'][0]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][3]['record_type']
|
assert 'MS' == data['data']['records'][3]['record_type']
|
||||||
@ -324,7 +324,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Tue, 15 May 2018 14:05:00 GMT'
|
'Tue, 15 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 2 == data['data']['records'][0]['activity_id']
|
assert 2 == data['data']['records'][0]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][0]['record_type']
|
assert 'AS' == data['data']['records'][0]['record_type']
|
||||||
@ -334,7 +334,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][1]['activity_date']
|
== data['data']['records'][1]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][1]['user_id']
|
assert 'test' == data['data']['records'][1]['user']
|
||||||
assert 1 == data['data']['records'][1]['sport_id']
|
assert 1 == data['data']['records'][1]['sport_id']
|
||||||
assert 1 == data['data']['records'][1]['activity_id']
|
assert 1 == data['data']['records'][1]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][1]['record_type']
|
assert 'FD' == data['data']['records'][1]['record_type']
|
||||||
@ -344,7 +344,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][2]['activity_date']
|
== data['data']['records'][2]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][2]['user_id']
|
assert 'test' == data['data']['records'][2]['user']
|
||||||
assert 1 == data['data']['records'][2]['sport_id']
|
assert 1 == data['data']['records'][2]['sport_id']
|
||||||
assert 1 == data['data']['records'][2]['activity_id']
|
assert 1 == data['data']['records'][2]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][2]['record_type']
|
assert 'LD' == data['data']['records'][2]['record_type']
|
||||||
@ -354,7 +354,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Tue, 15 May 2018 14:05:00 GMT'
|
'Tue, 15 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 2 == data['data']['records'][0]['activity_id']
|
assert 2 == data['data']['records'][0]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][3]['record_type']
|
assert 'MS' == data['data']['records'][3]['record_type']
|
||||||
@ -388,7 +388,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Tue, 15 May 2018 14:05:00 GMT'
|
'Tue, 15 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 2 == data['data']['records'][0]['activity_id']
|
assert 2 == data['data']['records'][0]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][0]['record_type']
|
assert 'AS' == data['data']['records'][0]['record_type']
|
||||||
@ -398,7 +398,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][1]['activity_date']
|
== data['data']['records'][1]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][1]['user_id']
|
assert 'test' == data['data']['records'][1]['user']
|
||||||
assert 1 == data['data']['records'][1]['sport_id']
|
assert 1 == data['data']['records'][1]['sport_id']
|
||||||
assert 1 == data['data']['records'][1]['activity_id']
|
assert 1 == data['data']['records'][1]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][1]['record_type']
|
assert 'FD' == data['data']['records'][1]['record_type']
|
||||||
@ -408,7 +408,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Wed, 16 May 2018 14:05:00 GMT'
|
'Wed, 16 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][2]['activity_date']
|
== data['data']['records'][2]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][2]['user_id']
|
assert 'test' == data['data']['records'][2]['user']
|
||||||
assert 1 == data['data']['records'][2]['sport_id']
|
assert 1 == data['data']['records'][2]['sport_id']
|
||||||
assert 3 == data['data']['records'][2]['activity_id']
|
assert 3 == data['data']['records'][2]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][2]['record_type']
|
assert 'LD' == data['data']['records'][2]['record_type']
|
||||||
@ -418,7 +418,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Tue, 15 May 2018 14:05:00 GMT'
|
'Tue, 15 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 2 == data['data']['records'][0]['activity_id']
|
assert 2 == data['data']['records'][0]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][3]['record_type']
|
assert 'MS' == data['data']['records'][3]['record_type']
|
||||||
@ -449,7 +449,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 1 == data['data']['records'][0]['activity_id']
|
assert 1 == data['data']['records'][0]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][0]['record_type']
|
assert 'AS' == data['data']['records'][0]['record_type']
|
||||||
@ -459,7 +459,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][1]['activity_date']
|
== data['data']['records'][1]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][1]['user_id']
|
assert 'test' == data['data']['records'][1]['user']
|
||||||
assert 1 == data['data']['records'][1]['sport_id']
|
assert 1 == data['data']['records'][1]['sport_id']
|
||||||
assert 1 == data['data']['records'][1]['activity_id']
|
assert 1 == data['data']['records'][1]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][1]['record_type']
|
assert 'FD' == data['data']['records'][1]['record_type']
|
||||||
@ -469,7 +469,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Wed, 16 May 2018 14:05:00 GMT'
|
'Wed, 16 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][2]['activity_date']
|
== data['data']['records'][2]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][2]['user_id']
|
assert 'test' == data['data']['records'][2]['user']
|
||||||
assert 1 == data['data']['records'][2]['sport_id']
|
assert 1 == data['data']['records'][2]['sport_id']
|
||||||
assert 3 == data['data']['records'][2]['activity_id']
|
assert 3 == data['data']['records'][2]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][2]['record_type']
|
assert 'LD' == data['data']['records'][2]['record_type']
|
||||||
@ -479,7 +479,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][3]['activity_date']
|
== data['data']['records'][3]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][3]['user_id']
|
assert 'test' == data['data']['records'][3]['user']
|
||||||
assert 1 == data['data']['records'][3]['sport_id']
|
assert 1 == data['data']['records'][3]['sport_id']
|
||||||
assert 1 == data['data']['records'][3]['activity_id']
|
assert 1 == data['data']['records'][3]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][3]['record_type']
|
assert 'MS' == data['data']['records'][3]['record_type']
|
||||||
@ -521,7 +521,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 1 == data['data']['records'][0]['activity_id']
|
assert 1 == data['data']['records'][0]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][0]['record_type']
|
assert 'AS' == data['data']['records'][0]['record_type']
|
||||||
@ -531,7 +531,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][1]['activity_date']
|
== data['data']['records'][1]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][1]['user_id']
|
assert 'test' == data['data']['records'][1]['user']
|
||||||
assert 1 == data['data']['records'][1]['sport_id']
|
assert 1 == data['data']['records'][1]['sport_id']
|
||||||
assert 1 == data['data']['records'][1]['activity_id']
|
assert 1 == data['data']['records'][1]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][1]['record_type']
|
assert 'FD' == data['data']['records'][1]['record_type']
|
||||||
@ -541,7 +541,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Wed, 16 May 2018 14:05:00 GMT'
|
'Wed, 16 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][2]['activity_date']
|
== data['data']['records'][2]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][2]['user_id']
|
assert 'test' == data['data']['records'][2]['user']
|
||||||
assert 1 == data['data']['records'][2]['sport_id']
|
assert 1 == data['data']['records'][2]['sport_id']
|
||||||
assert 3 == data['data']['records'][2]['activity_id']
|
assert 3 == data['data']['records'][2]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][2]['record_type']
|
assert 'LD' == data['data']['records'][2]['record_type']
|
||||||
@ -551,7 +551,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][3]['activity_date']
|
== data['data']['records'][3]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][3]['user_id']
|
assert 'test' == data['data']['records'][3]['user']
|
||||||
assert 1 == data['data']['records'][3]['sport_id']
|
assert 1 == data['data']['records'][3]['sport_id']
|
||||||
assert 1 == data['data']['records'][3]['activity_id']
|
assert 1 == data['data']['records'][3]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][3]['record_type']
|
assert 'MS' == data['data']['records'][3]['record_type']
|
||||||
@ -595,7 +595,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 08:05:00 GMT'
|
'Mon, 14 May 2018 08:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 5 == data['data']['records'][0]['activity_id']
|
assert 5 == data['data']['records'][0]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][0]['record_type']
|
assert 'AS' == data['data']['records'][0]['record_type']
|
||||||
@ -605,7 +605,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 08:05:00 GMT'
|
'Mon, 14 May 2018 08:05:00 GMT'
|
||||||
== data['data']['records'][1]['activity_date']
|
== data['data']['records'][1]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][1]['user_id']
|
assert 'test' == data['data']['records'][1]['user']
|
||||||
assert 1 == data['data']['records'][1]['sport_id']
|
assert 1 == data['data']['records'][1]['sport_id']
|
||||||
assert 5 == data['data']['records'][1]['activity_id']
|
assert 5 == data['data']['records'][1]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][1]['record_type']
|
assert 'FD' == data['data']['records'][1]['record_type']
|
||||||
@ -615,7 +615,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Wed, 16 May 2018 14:05:00 GMT'
|
'Wed, 16 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][2]['activity_date']
|
== data['data']['records'][2]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][2]['user_id']
|
assert 'test' == data['data']['records'][2]['user']
|
||||||
assert 1 == data['data']['records'][2]['sport_id']
|
assert 1 == data['data']['records'][2]['sport_id']
|
||||||
assert 3 == data['data']['records'][2]['activity_id']
|
assert 3 == data['data']['records'][2]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][2]['record_type']
|
assert 'LD' == data['data']['records'][2]['record_type']
|
||||||
@ -625,7 +625,7 @@ def test_get_records_after_activities_post_and_patch(
|
|||||||
'Mon, 14 May 2018 08:05:00 GMT'
|
'Mon, 14 May 2018 08:05:00 GMT'
|
||||||
== data['data']['records'][3]['activity_date']
|
== data['data']['records'][3]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][3]['user_id']
|
assert 'test' == data['data']['records'][3]['user']
|
||||||
assert 1 == data['data']['records'][3]['sport_id']
|
assert 1 == data['data']['records'][3]['sport_id']
|
||||||
assert 5 == data['data']['records'][3]['activity_id']
|
assert 5 == data['data']['records'][3]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][3]['record_type']
|
assert 'MS' == data['data']['records'][3]['record_type']
|
||||||
@ -768,7 +768,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 1 == data['data']['records'][0]['activity_id']
|
assert 1 == data['data']['records'][0]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][0]['record_type']
|
assert 'AS' == data['data']['records'][0]['record_type']
|
||||||
@ -778,7 +778,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][1]['activity_date']
|
== data['data']['records'][1]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][1]['user_id']
|
assert 'test' == data['data']['records'][1]['user']
|
||||||
assert 1 == data['data']['records'][1]['sport_id']
|
assert 1 == data['data']['records'][1]['sport_id']
|
||||||
assert 1 == data['data']['records'][1]['activity_id']
|
assert 1 == data['data']['records'][1]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][1]['record_type']
|
assert 'FD' == data['data']['records'][1]['record_type']
|
||||||
@ -788,7 +788,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][2]['activity_date']
|
== data['data']['records'][2]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][2]['user_id']
|
assert 'test' == data['data']['records'][2]['user']
|
||||||
assert 1 == data['data']['records'][2]['sport_id']
|
assert 1 == data['data']['records'][2]['sport_id']
|
||||||
assert 1 == data['data']['records'][2]['activity_id']
|
assert 1 == data['data']['records'][2]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][2]['record_type']
|
assert 'LD' == data['data']['records'][2]['record_type']
|
||||||
@ -798,7 +798,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][3]['activity_date']
|
== data['data']['records'][3]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][3]['user_id']
|
assert 'test' == data['data']['records'][3]['user']
|
||||||
assert 1 == data['data']['records'][3]['sport_id']
|
assert 1 == data['data']['records'][3]['sport_id']
|
||||||
assert 1 == data['data']['records'][3]['activity_id']
|
assert 1 == data['data']['records'][3]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][3]['record_type']
|
assert 'MS' == data['data']['records'][3]['record_type']
|
||||||
@ -808,7 +808,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Wed, 16 May 2018 16:05:00 GMT'
|
'Wed, 16 May 2018 16:05:00 GMT'
|
||||||
== data['data']['records'][4]['activity_date']
|
== data['data']['records'][4]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][4]['user_id']
|
assert 'test' == data['data']['records'][4]['user']
|
||||||
assert 2 == data['data']['records'][4]['sport_id']
|
assert 2 == data['data']['records'][4]['sport_id']
|
||||||
assert 2 == data['data']['records'][4]['activity_id']
|
assert 2 == data['data']['records'][4]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][4]['record_type']
|
assert 'AS' == data['data']['records'][4]['record_type']
|
||||||
@ -818,7 +818,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Wed, 16 May 2018 16:05:00 GMT'
|
'Wed, 16 May 2018 16:05:00 GMT'
|
||||||
== data['data']['records'][5]['activity_date']
|
== data['data']['records'][5]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][5]['user_id']
|
assert 'test' == data['data']['records'][5]['user']
|
||||||
assert 2 == data['data']['records'][5]['sport_id']
|
assert 2 == data['data']['records'][5]['sport_id']
|
||||||
assert 2 == data['data']['records'][5]['activity_id']
|
assert 2 == data['data']['records'][5]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][5]['record_type']
|
assert 'FD' == data['data']['records'][5]['record_type']
|
||||||
@ -828,7 +828,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Wed, 16 May 2018 16:05:00 GMT'
|
'Wed, 16 May 2018 16:05:00 GMT'
|
||||||
== data['data']['records'][6]['activity_date']
|
== data['data']['records'][6]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][6]['user_id']
|
assert 'test' == data['data']['records'][6]['user']
|
||||||
assert 2 == data['data']['records'][6]['sport_id']
|
assert 2 == data['data']['records'][6]['sport_id']
|
||||||
assert 2 == data['data']['records'][6]['activity_id']
|
assert 2 == data['data']['records'][6]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][6]['record_type']
|
assert 'LD' == data['data']['records'][6]['record_type']
|
||||||
@ -838,7 +838,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Wed, 16 May 2018 16:05:00 GMT'
|
'Wed, 16 May 2018 16:05:00 GMT'
|
||||||
== data['data']['records'][7]['activity_date']
|
== data['data']['records'][7]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][7]['user_id']
|
assert 'test' == data['data']['records'][7]['user']
|
||||||
assert 2 == data['data']['records'][7]['sport_id']
|
assert 2 == data['data']['records'][7]['sport_id']
|
||||||
assert 2 == data['data']['records'][7]['activity_id']
|
assert 2 == data['data']['records'][7]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][7]['record_type']
|
assert 'MS' == data['data']['records'][7]['record_type']
|
||||||
@ -870,7 +870,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Wed, 16 May 2018 16:05:00 GMT'
|
'Wed, 16 May 2018 16:05:00 GMT'
|
||||||
== data['data']['records'][0]['activity_date']
|
== data['data']['records'][0]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][0]['user_id']
|
assert 'test' == data['data']['records'][0]['user']
|
||||||
assert 1 == data['data']['records'][0]['sport_id']
|
assert 1 == data['data']['records'][0]['sport_id']
|
||||||
assert 2 == data['data']['records'][0]['activity_id']
|
assert 2 == data['data']['records'][0]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][0]['record_type']
|
assert 'AS' == data['data']['records'][0]['record_type']
|
||||||
@ -880,7 +880,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Wed, 16 May 2018 16:05:00 GMT'
|
'Wed, 16 May 2018 16:05:00 GMT'
|
||||||
== data['data']['records'][1]['activity_date']
|
== data['data']['records'][1]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][1]['user_id']
|
assert 'test' == data['data']['records'][1]['user']
|
||||||
assert 1 == data['data']['records'][1]['sport_id']
|
assert 1 == data['data']['records'][1]['sport_id']
|
||||||
assert 2 == data['data']['records'][1]['activity_id']
|
assert 2 == data['data']['records'][1]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][1]['record_type']
|
assert 'FD' == data['data']['records'][1]['record_type']
|
||||||
@ -890,7 +890,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Mon, 14 May 2018 14:05:00 GMT'
|
'Mon, 14 May 2018 14:05:00 GMT'
|
||||||
== data['data']['records'][2]['activity_date']
|
== data['data']['records'][2]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][2]['user_id']
|
assert 'test' == data['data']['records'][2]['user']
|
||||||
assert 1 == data['data']['records'][2]['sport_id']
|
assert 1 == data['data']['records'][2]['sport_id']
|
||||||
assert 1 == data['data']['records'][2]['activity_id']
|
assert 1 == data['data']['records'][2]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][2]['record_type']
|
assert 'LD' == data['data']['records'][2]['record_type']
|
||||||
@ -900,7 +900,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Wed, 16 May 2018 16:05:00 GMT'
|
'Wed, 16 May 2018 16:05:00 GMT'
|
||||||
== data['data']['records'][3]['activity_date']
|
== data['data']['records'][3]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][3]['user_id']
|
assert 'test' == data['data']['records'][3]['user']
|
||||||
assert 1 == data['data']['records'][3]['sport_id']
|
assert 1 == data['data']['records'][3]['sport_id']
|
||||||
assert 2 == data['data']['records'][3]['activity_id']
|
assert 2 == data['data']['records'][3]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][3]['record_type']
|
assert 'MS' == data['data']['records'][3]['record_type']
|
||||||
@ -910,7 +910,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Fri, 18 May 2018 18:05:00 GMT'
|
'Fri, 18 May 2018 18:05:00 GMT'
|
||||||
== data['data']['records'][4]['activity_date']
|
== data['data']['records'][4]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][4]['user_id']
|
assert 'test' == data['data']['records'][4]['user']
|
||||||
assert 2 == data['data']['records'][4]['sport_id']
|
assert 2 == data['data']['records'][4]['sport_id']
|
||||||
assert 4 == data['data']['records'][4]['activity_id']
|
assert 4 == data['data']['records'][4]['activity_id']
|
||||||
assert 'AS' == data['data']['records'][4]['record_type']
|
assert 'AS' == data['data']['records'][4]['record_type']
|
||||||
@ -920,7 +920,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Fri, 18 May 2018 18:05:00 GMT'
|
'Fri, 18 May 2018 18:05:00 GMT'
|
||||||
== data['data']['records'][5]['activity_date']
|
== data['data']['records'][5]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][5]['user_id']
|
assert 'test' == data['data']['records'][5]['user']
|
||||||
assert 2 == data['data']['records'][5]['sport_id']
|
assert 2 == data['data']['records'][5]['sport_id']
|
||||||
assert 4 == data['data']['records'][5]['activity_id']
|
assert 4 == data['data']['records'][5]['activity_id']
|
||||||
assert 'FD' == data['data']['records'][5]['record_type']
|
assert 'FD' == data['data']['records'][5]['record_type']
|
||||||
@ -930,7 +930,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Fri, 18 May 2018 18:05:00 GMT'
|
'Fri, 18 May 2018 18:05:00 GMT'
|
||||||
== data['data']['records'][6]['activity_date']
|
== data['data']['records'][6]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][6]['user_id']
|
assert 'test' == data['data']['records'][6]['user']
|
||||||
assert 2 == data['data']['records'][6]['sport_id']
|
assert 2 == data['data']['records'][6]['sport_id']
|
||||||
assert 4 == data['data']['records'][6]['activity_id']
|
assert 4 == data['data']['records'][6]['activity_id']
|
||||||
assert 'LD' == data['data']['records'][6]['record_type']
|
assert 'LD' == data['data']['records'][6]['record_type']
|
||||||
@ -940,7 +940,7 @@ def test_get_records_after_sport_change(
|
|||||||
'Fri, 18 May 2018 18:05:00 GMT'
|
'Fri, 18 May 2018 18:05:00 GMT'
|
||||||
== data['data']['records'][7]['activity_date']
|
== data['data']['records'][7]['activity_date']
|
||||||
) # noqa
|
) # noqa
|
||||||
assert 1 == data['data']['records'][7]['user_id']
|
assert 'test' == data['data']['records'][7]['user']
|
||||||
assert 2 == data['data']['records'][7]['sport_id']
|
assert 2 == data['data']['records'][7]['sport_id']
|
||||||
assert 4 == data['data']['records'][7]['activity_id']
|
assert 4 == data['data']['records'][7]['activity_id']
|
||||||
assert 'MS' == data['data']['records'][7]['record_type']
|
assert 'MS' == data['data']['records'][7]['record_type']
|
||||||
|
@ -9,7 +9,7 @@ def test_record_model(app, user_1, sport_1_cycling, activity_cycling_user_1):
|
|||||||
sport_id=activity_cycling_user_1.sport_id,
|
sport_id=activity_cycling_user_1.sport_id,
|
||||||
record_type='LD',
|
record_type='LD',
|
||||||
).first()
|
).first()
|
||||||
assert 1 == record_ld.user_id
|
assert 'test' == record_ld.user.username
|
||||||
assert 1 == record_ld.sport_id
|
assert 1 == record_ld.sport_id
|
||||||
assert 1 == record_ld.activity_id
|
assert 1 == record_ld.activity_id
|
||||||
assert 'LD' == record_ld.record_type
|
assert 'LD' == record_ld.record_type
|
||||||
@ -18,7 +18,7 @@ def test_record_model(app, user_1, sport_1_cycling, activity_cycling_user_1):
|
|||||||
|
|
||||||
record_serialize = record_ld.serialize()
|
record_serialize = record_ld.serialize()
|
||||||
assert 'id' in record_serialize
|
assert 'id' in record_serialize
|
||||||
assert 'user_id' in record_serialize
|
assert 'user' in record_serialize
|
||||||
assert 'sport_id' in record_serialize
|
assert 'sport_id' in record_serialize
|
||||||
assert 'activity_id' in record_serialize
|
assert 'activity_id' in record_serialize
|
||||||
assert 'record_type' in record_serialize
|
assert 'record_type' in record_serialize
|
||||||
@ -35,7 +35,7 @@ def test_record_model_none_value(
|
|||||||
record_type='LD',
|
record_type='LD',
|
||||||
).first()
|
).first()
|
||||||
record_ld.value = None
|
record_ld.value = None
|
||||||
assert 1 == record_ld.user_id
|
assert 'test' == record_ld.user.username
|
||||||
assert 1 == record_ld.sport_id
|
assert 1 == record_ld.sport_id
|
||||||
assert 1 == record_ld.activity_id
|
assert 1 == record_ld.activity_id
|
||||||
assert 'LD' == record_ld.record_type
|
assert 'LD' == record_ld.record_type
|
||||||
|
@ -9,7 +9,7 @@ def test_get_stats_by_time_no_activities(app, user_1):
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time',
|
f'/api/stats/{user_1.username}/by_time',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -58,7 +58,7 @@ def test_get_stats_by_time_all_activities_error(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time?from="2018-04-01&to=2018-04-30',
|
f'/api/stats/{user_1.username}/by_time?from="2018-04-01&to=2018-04-30',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -89,7 +89,7 @@ def test_get_stats_by_time_all_activities_invalid_period(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time?from=2018-04-01&to=2018-04-30&time=day', # noqa
|
f'/api/stats/{user_1.username}/by_time?from=2018-04-01&to=2018-04-30&time=day', # noqa
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -117,7 +117,7 @@ def test_get_stats_by_time_all_activities(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time',
|
f'/api/stats/{user_1.username}/by_time',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -165,7 +165,7 @@ def test_get_stats_by_time_all_activities_april_2018(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time?from=2018-04-01&to=2018-04-30',
|
f'/api/stats/{user_1.username}/by_time?from=2018-04-01&to=2018-04-30',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -206,7 +206,8 @@ def test_get_stats_by_time_all_activities_april_2018_paris(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1_paris.id}/by_time?from=2018-04-01&to=2018-04-30',
|
f'/api/stats/{user_1_paris.username}/by_time?'
|
||||||
|
f'from=2018-04-01&to=2018-04-30',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -247,7 +248,7 @@ def test_get_stats_by_year_all_activities(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time?time=year',
|
f'/api/stats/{user_1.username}/by_time?time=year',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -295,7 +296,7 @@ def test_get_stats_by_year_all_activities_april_2018(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time?from=2018-04-01&to=2018-04-30&time=year', # noqa
|
f'/api/stats/{user_1.username}/by_time?from=2018-04-01&to=2018-04-30&time=year', # noqa
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -336,7 +337,7 @@ def test_get_stats_by_year_all_activities_april_2018_paris(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1_paris.id}/by_time?from=2018-04-01&to=2018-04-30&time=year', # noqa
|
f'/api/stats/{user_1_paris.username}/by_time?from=2018-04-01&to=2018-04-30&time=year', # noqa
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -377,7 +378,7 @@ def test_get_stats_by_month_all_activities(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time?time=month',
|
f'/api/stats/{user_1.username}/by_time?time=month',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -453,7 +454,7 @@ def test_get_stats_by_month_all_activities_new_york(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1_full.id}/by_time?time=month',
|
f'/api/stats/{user_1_full.username}/by_time?time=month',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -529,7 +530,7 @@ def test_get_stats_by_month_all_activities_april_2018(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time?from=2018-04-01&to=2018-04-30&time=month', # noqa
|
f'/api/stats/{user_1.username}/by_time?from=2018-04-01&to=2018-04-30&time=month', # noqa
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -570,7 +571,7 @@ def test_get_stats_by_week_all_activities(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1_full.id}/by_time?time=week',
|
f'/api/stats/{user_1_full.username}/by_time?time=week',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -646,7 +647,7 @@ def test_get_stats_by_week_all_activities_week_13(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time?from=2018-04-01&to=2018-04-30&time=week', # noqa
|
f'/api/stats/{user_1.username}/by_time?from=2018-04-01&to=2018-04-30&time=week', # noqa
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -687,7 +688,7 @@ def test_get_stats_by_weekm_all_activities(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time?time=weekm',
|
f'/api/stats/{user_1.username}/by_time?time=weekm',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -763,7 +764,7 @@ def test_get_stats_by_weekm_all_activities_week_13(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_time?from=2018-04-01&to=2018-04-30&time=weekm', # noqa
|
f'/api/stats/{user_1.username}/by_time?from=2018-04-01&to=2018-04-30&time=weekm', # noqa
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -804,7 +805,7 @@ def test_get_stats_by_sport_all_activities(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_sport',
|
f'/api/stats/{user_1.username}/by_sport',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -843,7 +844,7 @@ def test_get_stats_by_sport_all_activities_sport_1(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_sport?sport_id=1',
|
f'/api/stats/{user_1.username}/by_sport?sport_id=1',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -905,7 +906,7 @@ def test_get_stats_by_sport_all_activities_invalid_sport(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_sport?sport_id=999',
|
f'/api/stats/{user_1.username}/by_sport?sport_id=999',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
@ -933,7 +934,7 @@ def test_get_stats_by_sport_all_activities_error(
|
|||||||
content_type='application/json',
|
content_type='application/json',
|
||||||
)
|
)
|
||||||
response = client.get(
|
response = client.get(
|
||||||
f'/api/stats/{user_1.id}/by_sport?sport_id="999',
|
f'/api/stats/{user_1.username}/by_sport?sport_id="999',
|
||||||
headers=dict(
|
headers=dict(
|
||||||
Authorization='Bearer '
|
Authorization='Bearer '
|
||||||
+ json.loads(resp_login.data.decode())['auth_token']
|
+ json.loads(resp_login.data.decode())['auth_token']
|
||||||
|
@ -26,10 +26,10 @@ class User(db.Model):
|
|||||||
# does the week start Monday?
|
# does the week start Monday?
|
||||||
weekm = db.Column(db.Boolean(50), default=False, nullable=False)
|
weekm = db.Column(db.Boolean(50), default=False, nullable=False)
|
||||||
activities = db.relationship(
|
activities = db.relationship(
|
||||||
'Activity', lazy=True, backref=db.backref('users', lazy='joined')
|
'Activity', lazy=True, backref=db.backref('user', lazy='joined')
|
||||||
)
|
)
|
||||||
records = db.relationship(
|
records = db.relationship(
|
||||||
'Record', lazy=True, backref=db.backref('users', lazy='joined')
|
'Record', lazy=True, backref=db.backref('user', lazy='joined')
|
||||||
)
|
)
|
||||||
language = db.Column(db.String(50), nullable=True)
|
language = db.Column(db.String(50), nullable=True)
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import FitTrackeeGenericApi from '../fitTrackeeApi'
|
import FitTrackeeGenericApi from '../fitTrackeeApi'
|
||||||
import { setData, setError } from './index'
|
import { setData, setError } from './index'
|
||||||
|
|
||||||
export const getStats = (userId, type, data) => dispatch =>
|
export const getStats = (userName, type, data) => dispatch =>
|
||||||
FitTrackeeGenericApi.getData(`stats/${userId}/${type}`, data)
|
FitTrackeeGenericApi.getData(`stats/${userName}/${type}`, data)
|
||||||
.then(ret => {
|
.then(ret => {
|
||||||
if (ret.status === 'success') {
|
if (ret.status === 'success') {
|
||||||
dispatch(setData('statistics', ret.data))
|
dispatch(setData('statistics', ret.data))
|
||||||
|
@ -13,7 +13,8 @@ class Statistics extends React.PureComponent {
|
|||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
if (
|
if (
|
||||||
(this.props.user.id && this.props.user.id !== prevProps.user.id) ||
|
(this.props.user.username &&
|
||||||
|
this.props.user.username !== prevProps.user.username) ||
|
||||||
this.props.statsParams !== prevProps.statsParams
|
this.props.statsParams !== prevProps.statsParams
|
||||||
) {
|
) {
|
||||||
this.updateData()
|
this.updateData()
|
||||||
@ -21,9 +22,9 @@ class Statistics extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateData() {
|
updateData() {
|
||||||
if (this.props.user.id) {
|
if (this.props.user.username) {
|
||||||
this.props.loadActivities(
|
this.props.loadActivities(
|
||||||
this.props.user.id,
|
this.props.user.username,
|
||||||
this.props.user.weekm,
|
this.props.user.weekm,
|
||||||
this.props.statsParams
|
this.props.statsParams
|
||||||
)
|
)
|
||||||
@ -61,7 +62,7 @@ export default connect(
|
|||||||
user: state.user,
|
user: state.user,
|
||||||
}),
|
}),
|
||||||
dispatch => ({
|
dispatch => ({
|
||||||
loadActivities: (userId, weekm, data) => {
|
loadActivities: (userName, weekm, data) => {
|
||||||
const dateFormat = 'yyyy-MM-dd'
|
const dateFormat = 'yyyy-MM-dd'
|
||||||
// depends on user config (first day of week)
|
// depends on user config (first day of week)
|
||||||
const time =
|
const time =
|
||||||
@ -73,7 +74,7 @@ export default connect(
|
|||||||
to: format(data.end, dateFormat),
|
to: format(data.end, dateFormat),
|
||||||
time: time,
|
time: time,
|
||||||
}
|
}
|
||||||
dispatch(getStats(userId, data.type, params))
|
dispatch(getStats(userName, data.type, params))
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
)(Statistics)
|
)(Statistics)
|
||||||
|
Loading…
Reference in New Issue
Block a user