"...Irrlicht/svn:/svn.code.sf.net/p/irrlicht/code/trunk@3600" did not exist on "884b7de39c55743aa1dd68e0e8456377362289c8"
Commit 092fadcd authored by nanahira's avatar nanahira

rename all entites to original name

parent 9acd774c
Pipeline #2466 passed with stages
in 39 seconds
...@@ -276,12 +276,13 @@ export class AppService { ...@@ -276,12 +276,13 @@ export class AppService {
} }
} }
async getReport(inputFromTime: string, inputToTime: string) { async getReport(inputFrom_time: string, inputTo_time: string) {
const fromTime = (inputFromTime ? moment(inputFromTime) : moment()).format( const from_time = (inputFrom_time
'YYYY-MM-DD', ? moment(inputFrom_time)
); : moment()
const toTime = (inputToTime ).format('YYYY-MM-DD');
? moment(inputToTime) const to_time = (inputTo_time
? moment(inputTo_time)
: moment().add(1, 'day') : moment().add(1, 'day')
).format('YYYY-MM-DD'); ).format('YYYY-MM-DD');
try { try {
...@@ -301,16 +302,16 @@ export class AppService { ...@@ -301,16 +302,16 @@ export class AppService {
.select('count(*)', 'entertainTotal') .select('count(*)', 'entertainTotal')
.from(BattleHistory, 'battleHistory') .from(BattleHistory, 'battleHistory')
.where('type = :type', { type: 'entertain' }) .where('type = :type', { type: 'entertain' })
.andWhere('start_time >= :fromTime', { fromTime }) .andWhere('start_time >= :from_time', { from_time })
.andWhere('start_time < :toTime', { toTime }) .andWhere('start_time < :to_time', { to_time })
.getRawOne(), .getRawOne(),
this.mcdb.manager this.mcdb.manager
.createQueryBuilder() .createQueryBuilder()
.select('count(*)', 'entertainDisconnect') .select('count(*)', 'entertainDisconnect')
.from(BattleHistory, 'battleHistory') .from(BattleHistory, 'battleHistory')
.where('type = :type', { type: 'entertain' }) .where('type = :type', { type: 'entertain' })
.andWhere('start_time >= :fromTime', { fromTime }) .andWhere('start_time >= :from_time', { from_time })
.andWhere('start_time < :toTime', { toTime }) .andWhere('start_time < :to_time', { to_time })
.andWhere('(userscorea < 0 or userscoreb < 0)') .andWhere('(userscorea < 0 or userscoreb < 0)')
.getRawOne(), .getRawOne(),
this.mcdb.manager this.mcdb.manager
...@@ -318,24 +319,24 @@ export class AppService { ...@@ -318,24 +319,24 @@ export class AppService {
.select('count(DISTINCT usernamea)', 'entertainUsers') .select('count(DISTINCT usernamea)', 'entertainUsers')
.from(BattleHistory, 'battleHistory') .from(BattleHistory, 'battleHistory')
.where('type = :type', { type: 'entertain' }) .where('type = :type', { type: 'entertain' })
.andWhere('start_time >= :fromTime', { fromTime }) .andWhere('start_time >= :from_time', { from_time })
.andWhere('start_time < :toTime', { toTime }) .andWhere('start_time < :to_time', { to_time })
.getRawOne(), .getRawOne(),
this.mcdb.manager this.mcdb.manager
.createQueryBuilder() .createQueryBuilder()
.select('count(*)', 'athleticTotal') .select('count(*)', 'athleticTotal')
.from(BattleHistory, 'battleHistory') .from(BattleHistory, 'battleHistory')
.where('type = :type', { type: 'athletic' }) .where('type = :type', { type: 'athletic' })
.andWhere('start_time >= :fromTime', { fromTime }) .andWhere('start_time >= :from_time', { from_time })
.andWhere('start_time < :toTime', { toTime }) .andWhere('start_time < :to_time', { to_time })
.getRawOne(), .getRawOne(),
this.mcdb.manager this.mcdb.manager
.createQueryBuilder() .createQueryBuilder()
.select('count(*)', 'athleticDisconnect') .select('count(*)', 'athleticDisconnect')
.from(BattleHistory, 'battleHistory') .from(BattleHistory, 'battleHistory')
.where('type = :type', { type: 'athletic' }) .where('type = :type', { type: 'athletic' })
.andWhere('start_time >= :fromTime', { fromTime }) .andWhere('start_time >= :from_time', { from_time })
.andWhere('start_time < :toTime', { toTime }) .andWhere('start_time < :to_time', { to_time })
.andWhere('(userscorea < 0 or userscoreb < 0)') .andWhere('(userscorea < 0 or userscoreb < 0)')
.getRawOne(), .getRawOne(),
this.mcdb.manager this.mcdb.manager
...@@ -343,30 +344,30 @@ export class AppService { ...@@ -343,30 +344,30 @@ export class AppService {
.select('count(DISTINCT usernamea)', 'athleticUsers') .select('count(DISTINCT usernamea)', 'athleticUsers')
.from(BattleHistory, 'battleHistory') .from(BattleHistory, 'battleHistory')
.where('type = :type', { type: 'athletic' }) .where('type = :type', { type: 'athletic' })
.andWhere('start_time >= :fromTime', { fromTime }) .andWhere('start_time >= :from_time', { from_time })
.andWhere('start_time < :toTime', { toTime }) .andWhere('start_time < :to_time', { to_time })
.getRawOne(), .getRawOne(),
this.mcdb.manager this.mcdb.manager
.createQueryBuilder() .createQueryBuilder()
.select('count(DISTINCT usernamea)', 'totalActive') .select('count(DISTINCT usernamea)', 'totalActive')
.from(BattleHistory, 'battleHistory') .from(BattleHistory, 'battleHistory')
.andWhere('start_time >= :fromTime', { fromTime }) .andWhere('start_time >= :from_time', { from_time })
.andWhere('start_time < :toTime', { toTime }) .andWhere('start_time < :to_time', { to_time })
.getRawOne(), .getRawOne(),
this.mcdb.getRepository(BattleHistory).find({ this.mcdb.getRepository(BattleHistory).find({
select: ['startTime'], select: ['start_time'],
where: { where: {
type: 'entertain', type: 'entertain',
startTime: MoreThanOrEqual(fromTime), start_time: MoreThanOrEqual(from_time),
endTime: LessThan(toTime), end_time: LessThan(to_time),
}, },
}), }),
this.mcdb.getRepository(BattleHistory).find({ this.mcdb.getRepository(BattleHistory).find({
select: ['startTime'], select: ['start_time'],
where: { where: {
type: 'athletic', type: 'athletic',
startTime: MoreThanOrEqual(fromTime), start_time: MoreThanOrEqual(from_time),
endTime: LessThan(toTime), end_time: LessThan(to_time),
}, },
}), }),
]); ]);
...@@ -383,8 +384,8 @@ export class AppService { ...@@ -383,8 +384,8 @@ export class AppService {
let totalEntertain = 0; let totalEntertain = 0;
_.forEach(hourlyAthletic, function (row) { _.forEach(hourlyAthletic, function (row) {
totalAthletic++; totalAthletic++;
dateHour = moment(row.startTime).format('YYYY-MM-DD HH'); dateHour = moment(row.start_time).format('YYYY-MM-DD HH');
h = moment(row.endTime).format('H'); h = moment(row.end_time).format('H');
if (hourlyDataMap['athletic'][dateHour]) { if (hourlyDataMap['athletic'][dateHour]) {
hourlyDataMap['athletic'][dateHour]++; hourlyDataMap['athletic'][dateHour]++;
} else { } else {
...@@ -399,8 +400,8 @@ export class AppService { ...@@ -399,8 +400,8 @@ export class AppService {
}); });
_.forEach(hourlyEntertain, function (row) { _.forEach(hourlyEntertain, function (row) {
totalEntertain++; totalEntertain++;
dateHour = moment(row.startTime).format('YYYY-MM-DD HH'); dateHour = moment(row.start_time).format('YYYY-MM-DD HH');
h = moment(row.endTime).format('H'); h = moment(row.end_time).format('H');
if (hourlyDataMap['entertain'][dateHour]) { if (hourlyDataMap['entertain'][dateHour]) {
hourlyDataMap['entertain'][dateHour]++; hourlyDataMap['entertain'][dateHour]++;
} else { } else {
...@@ -413,7 +414,7 @@ export class AppService { ...@@ -413,7 +414,7 @@ export class AppService {
hourlyAvgMapEntertain[h] = 1; hourlyAvgMapEntertain[h] = 1;
} }
}); });
const totalDays = moment(toTime).diff(fromTime, 'days'); const totalDays = moment(to_time).diff(from_time, 'days');
//饼图 //饼图
const legendDataAthletic = []; const legendDataAthletic = [];
...@@ -761,15 +762,15 @@ export class AppService { ...@@ -761,15 +762,15 @@ export class AppService {
battleHistory.userscoreb = userscoreB; battleHistory.userscoreb = userscoreB;
battleHistory.expa = expResult.expA; battleHistory.expa = expResult.expA;
battleHistory.expb = expResult.expB; battleHistory.expb = expResult.expB;
battleHistory.expaEx = userA.exp; battleHistory.expa_ex = userA.exp;
battleHistory.expbEx = userB.exp; battleHistory.expb_ex = userB.exp;
battleHistory.pta = ptResult.ptA; battleHistory.pta = ptResult.ptA;
battleHistory.ptb = ptResult.ptB; battleHistory.ptb = ptResult.ptB;
battleHistory.ptaEx = userA.pt; battleHistory.pta_ex = userA.pt;
battleHistory.ptbEx = userB.pt; battleHistory.ptb_ex = userB.pt;
battleHistory.type = arena; battleHistory.type = arena;
battleHistory.startTime = moment(start).toDate(); battleHistory.start_time = moment(start).toDate();
battleHistory.endTime = moment(end).toDate(); battleHistory.end_time = moment(end).toDate();
battleHistory.winner = winner; battleHistory.winner = winner;
battleHistory.isfirstwin = firstWin; battleHistory.isfirstwin = firstWin;
battleHistory.decka = deckA; battleHistory.decka = deckA;
...@@ -840,15 +841,15 @@ export class AppService { ...@@ -840,15 +841,15 @@ export class AppService {
battleHistory.userscoreb = userscoreB; battleHistory.userscoreb = userscoreB;
battleHistory.expa = expResult.expA; battleHistory.expa = expResult.expA;
battleHistory.expb = expResult.expB; battleHistory.expb = expResult.expB;
battleHistory.expaEx = userA.exp; battleHistory.expa_ex = userA.exp;
battleHistory.expbEx = userB.exp; battleHistory.expb_ex = userB.exp;
battleHistory.pta = userA.pt; battleHistory.pta = userA.pt;
battleHistory.ptb = userA.pt; battleHistory.ptb = userA.pt;
battleHistory.ptaEx = userA.pt; battleHistory.pta_ex = userA.pt;
battleHistory.ptbEx = userB.pt; battleHistory.ptb_ex = userB.pt;
battleHistory.type = arena; battleHistory.type = arena;
battleHistory.startTime = moment(start).toDate(); battleHistory.start_time = moment(start).toDate();
battleHistory.endTime = moment(end).toDate(); battleHistory.end_time = moment(end).toDate();
battleHistory.winner = winner; battleHistory.winner = winner;
battleHistory.isfirstwin = firstWin; battleHistory.isfirstwin = firstWin;
battleHistory.decka = deckA; battleHistory.decka = deckA;
...@@ -922,8 +923,8 @@ export class AppService { ...@@ -922,8 +923,8 @@ export class AppService {
} }
vote.title = title; vote.title = title;
vote.options = options; vote.options = options;
vote.startTime = start_time; vote.start_time = start_time;
vote.endTime = end_time; vote.end_time = end_time;
vote.status = status; vote.status = status;
vote.multiple = multiple; vote.multiple = multiple;
vote.max = max; vote.max = max;
...@@ -982,21 +983,21 @@ export class AppService { ...@@ -982,21 +983,21 @@ export class AppService {
} }
const voteResults = opids.map((opid) => { const voteResults = opids.map((opid) => {
const voteResult = new VoteResult(); const voteResult = new VoteResult();
voteResult.voteId = voteid; voteResult.vote_id = voteid;
voteResult.optionId = opid; voteResult.option_id = opid;
voteResult.userid = user; voteResult.userid = user;
voteResult.dateTime = date_time; voteResult.date_time = date_time;
voteResult.createTime = create_time; voteResult.create_time = create_time;
return voteResult; return voteResult;
}); });
await repo.save(voteResults); await repo.save(voteResults);
} else { } else {
const voteResult = new VoteResult(); const voteResult = new VoteResult();
voteResult.voteId = voteid; voteResult.vote_id = voteid;
voteResult.optionId = opid; voteResult.option_id = opid;
voteResult.userid = user; voteResult.userid = user;
voteResult.dateTime = date_time; voteResult.date_time = date_time;
voteResult.createTime = create_time; voteResult.create_time = create_time;
await repo.save(voteResult); await repo.save(voteResult);
} }
if (username) { if (username) {
...@@ -1020,8 +1021,8 @@ export class AppService { ...@@ -1020,8 +1021,8 @@ export class AppService {
optionCountMap, optionCountMap,
) { ) {
const count = await this.mcdb.getRepository(VoteResult).count({ const count = await this.mcdb.getRepository(VoteResult).count({
voteId: voteId.toString(), vote_id: voteId.toString(),
optionId: optionId.toString(), option_id: optionId.toString(),
}); });
optionCountMap[optionId] = count.toString(); // why to string? optionCountMap[optionId] = count.toString(); // why to string?
} }
...@@ -1102,12 +1103,12 @@ export class AppService { ...@@ -1102,12 +1103,12 @@ export class AppService {
}); });
const votedIds = ( const votedIds = (
await this.mcdb.getRepository(VoteResult).find({ await this.mcdb.getRepository(VoteResult).find({
select: ['voteId'], select: ['vote_id'],
where: { where: {
userid, userid,
}, },
}) })
).map((voteResult) => parseInt(voteResult.voteId)); ).map((voteResult) => parseInt(voteResult.vote_id));
const validVotes = allVotes.filter((vote) => !votedIds.includes(vote.id)); const validVotes = allVotes.filter((vote) => !votedIds.includes(vote.id));
if (validVotes.length) { if (validVotes.length) {
const index = Math.floor(Math.random() * validVotes.length); const index = Math.floor(Math.random() * validVotes.length);
......
...@@ -20,21 +20,21 @@ export class Ads { ...@@ -20,21 +20,21 @@ export class Ads {
nullable: true, nullable: true,
length: 1000, length: 1000,
}) })
imgpUrl: string; imgp_url: string;
@Column('character varying', { @Column('character varying', {
name: 'imgm_url', name: 'imgm_url',
nullable: true, nullable: true,
length: 1000, length: 1000,
}) })
imgmUrl: string; imgm_url: string;
@Column('character varying', { @Column('character varying', {
name: 'click_ref', name: 'click_ref',
nullable: true, nullable: true,
length: 1000, length: 1000,
}) })
clickRef: string; click_ref: string;
@Column('character varying', { @Column('character varying', {
name: 'click_url', name: 'click_url',
...@@ -48,7 +48,7 @@ export class Ads { ...@@ -48,7 +48,7 @@ export class Ads {
nullable: true, nullable: true,
length: 1000, length: 1000,
}) })
implUrl: string; impl_url: string;
@Column('integer', { name: 'impl', nullable: true, default: 0 }) @Column('integer', { name: 'impl', nullable: true, default: 0 })
impl: number; impl: number;
...@@ -63,13 +63,13 @@ export class Ads { ...@@ -63,13 +63,13 @@ export class Ads {
name: 'update_time', name: 'update_time',
nullable: true, nullable: true,
}) })
updateTime: Date; update_time: Date;
@Column('timestamp without time zone', { @Column('timestamp without time zone', {
name: 'create_time', name: 'create_time',
nullable: true, nullable: true,
}) })
createTime: Date; create_time: Date;
@Column('character varying', { @Column('character varying', {
name: 'type', name: 'type',
......
import { Column, Entity, Index, PrimaryColumn } from 'typeorm'; import { Column, Entity, Index, PrimaryColumn } from 'typeorm';
@Index('battle_history_end_time_index', ['endTime'], {}) @Index('battle_history_end_time_index', ['end_time'], {})
@Index('battle_history_usernamea_index', ['usernamea'], {}) @Index('battle_history_usernamea_index', ['usernamea'], {})
@Index('battle_history_usernameb_index', ['usernameb'], {}) @Index('battle_history_usernameb_index', ['usernameb'], {})
@Entity('battle_history', { schema: 'public' }) @Entity('battle_history', { schema: 'public' })
...@@ -39,7 +39,7 @@ export class BattleHistory { ...@@ -39,7 +39,7 @@ export class BattleHistory {
precision: 53, precision: 53,
default: 0, default: 0,
}) })
expaEx: number; expa_ex: number;
@Column('double precision', { @Column('double precision', {
name: 'expb_ex', name: 'expb_ex',
...@@ -47,7 +47,7 @@ export class BattleHistory { ...@@ -47,7 +47,7 @@ export class BattleHistory {
precision: 53, precision: 53,
default: 0, default: 0,
}) })
expbEx: number; expb_ex: number;
@Column('double precision', { @Column('double precision', {
name: 'pta', name: 'pta',
...@@ -71,7 +71,7 @@ export class BattleHistory { ...@@ -71,7 +71,7 @@ export class BattleHistory {
precision: 53, precision: 53,
default: 0, default: 0,
}) })
ptaEx: number; pta_ex: number;
@Column('double precision', { @Column('double precision', {
name: 'ptb_ex', name: 'ptb_ex',
...@@ -79,18 +79,18 @@ export class BattleHistory { ...@@ -79,18 +79,18 @@ export class BattleHistory {
precision: 53, precision: 53,
default: 0, default: 0,
}) })
ptbEx: number; ptb_ex: number;
@Column('character varying', { name: 'type', length: 100 }) @Column('character varying', { name: 'type', length: 100 })
type: string; type: string;
@Column('timestamp without time zone', { name: 'start_time', nullable: true }) @Column('timestamp without time zone', { name: 'start_time', nullable: true })
startTime: Date; start_time: Date;
@PrimaryColumn('timestamp without time zone', { @PrimaryColumn('timestamp without time zone', {
name: 'end_time', name: 'end_time',
}) })
endTime: Date; end_time: Date;
@Column('text', { name: 'winner', nullable: true }) @Column('text', { name: 'winner', nullable: true })
winner: string; winner: string;
......
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm'; import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
@Index('unique_index', ['optionId', 'userid', 'voteId'], { unique: true }) @Index('unique_index', ['option_id', 'userid', 'vote_id'], { unique: true })
@Entity('vote_result', { schema: 'public' }) @Entity('vote_result', { schema: 'public' })
export class VoteResult { export class VoteResult {
@PrimaryGeneratedColumn({ type: 'integer', name: 'id' }) @PrimaryGeneratedColumn({ type: 'integer', name: 'id' })
id: number; id: number;
@Column('character varying', { name: 'vote_id', unique: true, length: 100 }) @Column('character varying', { name: 'vote_id', unique: true, length: 100 })
voteId: string; vote_id: string;
@Column('character varying', { name: 'option_id', unique: true, length: 100 }) @Column('character varying', { name: 'option_id', unique: true, length: 100 })
optionId: string; option_id: string;
@Column('character varying', { name: 'userid', unique: true, length: 100 }) @Column('character varying', { name: 'userid', unique: true, length: 100 })
userid: string; userid: string;
@Column('character varying', { name: 'date_time', length: 100 }) @Column('character varying', { name: 'date_time', length: 100 })
dateTime: string; date_time: string;
@Column('timestamp without time zone', { @Column('timestamp without time zone', {
name: 'create_time', name: 'create_time',
nullable: true, nullable: true,
}) })
createTime: Date; create_time: Date;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment