Skip to content

Commit

Permalink
fix naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Danilenko committed Feb 20, 2024
1 parent 89d0e0e commit e1db231
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
20 changes: 10 additions & 10 deletions src/components/ChannelsStat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const logStore = useLogStore();
const channelChartKeys= [
'auditory' as keyof DayStat,
'audience' as keyof DayStat,
'liveViewers' as keyof DayStat,
'dvrViewers' as keyof DayStat,
'dvrMinutes' as keyof DayStat,
Expand All @@ -39,7 +39,7 @@ const channelTableHeaders = ref([
])
const auditoryChartOptions = {
const audienceChartOptions = {
xaxis: {
type: 'datetime',
labels: {
Expand All @@ -57,7 +57,7 @@ const channelChartOptions = {
}
};
const auditoryChartSeries = ref<ChartDateSeries>({name: 'auditory', data:[]});
const audienceChartSeries = ref<ChartDateSeries>({name: 'audience', data:[]});
const channelChartSeries = ref<ChartDateSeries[]>([]);
function makeChannelChart(value: keyof DayStat) {
Expand All @@ -69,16 +69,16 @@ function makeChannelChart(value: keyof DayStat) {
})
channelChartSeries.value.push(series);
});
auditoryChartSeries.value.data = [];
auditoryChartSeries.value.data = channelStore.dayStats.sort(function(a,b){
audienceChartSeries.value.data = [];
audienceChartSeries.value.data = channelStore.dayStats.sort(function(a, b){
if(a.date == b.date){
return 0;
}
return a.date > b.date ? -1:1
}).map((value: ChannelsDayStat)=>{
return {x: value.date, y: value.auditory}
return {x: value.date, y: value.audience}
})
console.dir(auditoryChartSeries);
console.dir(audienceChartSeries);
}
function load(){
channelStore.eraseStat()
Expand Down Expand Up @@ -118,12 +118,12 @@ defineExpose({load})
<div style="width: 100%; height: 500px;">
<apexchart height="500px" type="line" :options="channelChartOptions" :series="channelChartSeries"></apexchart>
</div>
<h3>{{$t('app.channels.auditory')}}</h3>
<h3>{{$t('app.channels.audience')}}</h3>
<div style="width: 100%; height: 500px;">
<apexchart height="500px" type="line" :options="auditoryChartOptions" :series="[auditoryChartSeries]"></apexchart>
<apexchart height="500px" type="line" :options="audienceChartOptions" :series="[audienceChartSeries]"></apexchart>
</div>
</v-card-text>
</v-card>
</v-card>x
<v-card>
<v-card-title>{{$t('app.channel.report.title')}} {{$t('app.channel.report.to_period')}} {{dayjs(range[0]).format('DD.MM.YYYY')}} - {{dayjs(range[range.length-1]).format('DD.MM.YYYY')}} </v-card-title>
<v-card-subtitle>{{$t('app.query.threshold')}}: {{threshold}}</v-card-subtitle>
Expand Down
4 changes: 2 additions & 2 deletions src/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"showHours": "Show duration in hours instead formatted duration"
},
"channels": {
"auditory": "Auditory: count of unique accounts which use TV"
"audience": "Audience: count of unique accounts which use TV"
},
"channel": {
"displayNumber": "Number",
Expand All @@ -38,7 +38,7 @@
"to_period": "on period"
},
"dayStat": {
"auditory": "Auditory: count of unique accounts which looked the channel",
"audience": "Audience: count of unique accounts which looked the channel",
"dvrMinutes": "DVR total view time",
"liveMinutes": "Live total view time",
"liveViewers": "Live viewers count",
Expand Down
10 changes: 5 additions & 5 deletions src/model/ChannelEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class DayStat {
averageViewingTime: number = 0;
totalTime: number = 0;
totalViewers: number = 0;
auditory: number = 0;
audience: number = 0;


addDvrMinutes(minutes: number){
Expand All @@ -34,8 +34,8 @@ export class DayStat {

}

addAuditory(count:number){
this.auditory += count;
addAudience(count:number){
this.audience += count;
}

}
Expand Down Expand Up @@ -66,8 +66,8 @@ export default class ChannelEntity {
this.dvrViewers++;
}

addAuditory(date: Date,count: number){
this.getStatDay(date).addAuditory(count)
addAudience(date: Date, count: number){
this.getStatDay(date).addAudience(count)
}

getStatDay(date: Date){
Expand Down
9 changes: 5 additions & 4 deletions src/store/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface State{

export class ChannelsDayStat{
date: Date = new Date();
auditory: number = 0;
audience: number = 0;
}

const logStore = useLogStore();
Expand Down Expand Up @@ -102,7 +102,8 @@ export const useChannelStore = defineStore('channelStore',{
});
},
async fillDay(value:Date, provider: Provider|null = null):Promise<number>{
this.getChannelsDayStat(value).auditory = 0;
this.getChannelsDayStat(value).audience = 0;

return new Promise((resolve)=>{
accountStatService.query(
{
Expand Down Expand Up @@ -135,13 +136,13 @@ export const useChannelStore = defineStore('channelStore',{
}

if(liveMinutes >= this.threshold || dvrMinutes >= this.threshold){
channelEntity.addAuditory(value,1);
channelEntity.addAudience(value,1);
channelViewCount++;
}
}
}
if(channelViewCount>0){
this.getChannelsDayStat(value).auditory++;
this.getChannelsDayStat(value).audience++;
}
count++;
if(count == accountData.provider_stat.length){
Expand Down

0 comments on commit e1db231

Please sign in to comment.