mirror of
https://github.com/status-im/fathom.git
synced 2025-03-01 03:20:27 +00:00
always show at least 1 visitor if there are pageviews. #129
This commit is contained in:
parent
0f08d8ed1d
commit
2ff9676043
@ -36,6 +36,11 @@ class Sidebar extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure we always show at least 1 visitor when there are pageviews
|
||||||
|
if ( data.Visitors == 0 && data.Pageviews > 0 ) {
|
||||||
|
data.Visitors = 1
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
data: data
|
data: data
|
||||||
@ -47,7 +52,7 @@ class Sidebar extends Component {
|
|||||||
return (
|
return (
|
||||||
<div class="box box-totals animated fadeInUp delayed_03s">
|
<div class="box box-totals animated fadeInUp delayed_03s">
|
||||||
<CountWidget title="Unique visitors" value={state.data.Visitors} loading={state.loading} />
|
<CountWidget title="Unique visitors" value={state.data.Visitors} loading={state.loading} />
|
||||||
<CountWidget title="Page views" value={state.data.Pageviews} loading={state.loading} />
|
<CountWidget title="Pageviews" value={state.data.Pageviews} loading={state.loading} />
|
||||||
<CountWidget title="Avg time on site" value={state.data.AvgDuration} format="duration" loading={state.loading} />
|
<CountWidget title="Avg time on site" value={state.data.AvgDuration} format="duration" loading={state.loading} />
|
||||||
<CountWidget title="Bounce rate" value={state.data.BounceRate} format="percentage" loading={state.loading} />
|
<CountWidget title="Bounce rate" value={state.data.BounceRate} format="percentage" loading={state.loading} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,8 +2,9 @@ package sqlstore
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"github.com/usefathom/fathom/pkg/models"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/usefathom/fathom/pkg/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (db *sqlstore) GetSiteStats(date time.Time) (*models.SiteStats, error) {
|
func (db *sqlstore) GetSiteStats(date time.Time) (*models.SiteStats, error) {
|
||||||
@ -49,6 +50,7 @@ func (db *sqlstore) GetAggregatedSiteStats(startDate time.Time, endDate time.Tim
|
|||||||
if err != nil && err == sql.ErrNoRows {
|
if err != nil && err == sql.ErrNoRows {
|
||||||
return nil, ErrNoResults
|
return nil, ErrNoResults
|
||||||
}
|
}
|
||||||
|
|
||||||
return stats, err
|
return stats, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user