Skip to content

Commit

Permalink
Replace convertTwoByteToOneByte to convertDBStr on ProgramsDB
Browse files Browse the repository at this point in the history
  • Loading branch information
mmntnth committed Jan 12, 2019
1 parent 9f59ed2 commit f0dea38
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/server/Model/DB/ProgramsDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ abstract class ProgramsDB extends DBTableBase implements ProgramsDBInterface {
/**
* insert 時の config を取得
*/
private getInsertConfig(): { insertMax: number; insertWait: number; convertTwoByteToOneByte: boolean } {
private getInsertConfig(): { insertMax: number; insertWait: number; convertDBStr: string } {
const config = this.config.getConfig();
let insertMax = config.programInsertMax || 10;
if (insertMax > 10) { insertMax = 10; }

return {
insertMax: insertMax,
insertWait: config.programInsertWait || 0,
convertTwoByteToOneByte: config.convertTwoByteToOneByte,
convertDBStr: config.convertDBStr,
};
}

Expand Down Expand Up @@ -175,7 +175,7 @@ abstract class ProgramsDB extends DBTableBase implements ProgramsDBInterface {
const channelType = channelTypes[program.networkId][program.serviceId].type;
const channel = channelTypes[program.networkId][program.serviceId].channel;

const name = StrUtil.toDBStr(program.name, config.convertTwoByteToOneByte);
const name = StrUtil.toDBStr(program.name, config.convertDBStr);
const tmp = [
program.id,
parseInt(program.networkId + (program.serviceId / 100000).toFixed(5).slice(2), 10),
Expand All @@ -190,8 +190,8 @@ abstract class ProgramsDB extends DBTableBase implements ProgramsDBInterface {
program.isFree,
name,
StrUtil.deleteBrackets(name),
typeof program.description === 'undefined' || program.description === '' ? null : StrUtil.toDBStr(program.description, config.convertTwoByteToOneByte),
this.createExtendedStr(program.extended, config.convertTwoByteToOneByte),
typeof program.description === 'undefined' || program.description === '' ? null : StrUtil.toDBStr(program.description, config.convertDBStr),
this.createExtendedStr(program.extended, config.convertDBStr),
genre1,
genre2,
genre3,
Expand Down Expand Up @@ -280,7 +280,7 @@ abstract class ProgramsDB extends DBTableBase implements ProgramsDBInterface {
* @param extended extended
* @return string
*/
private createExtendedStr(extended: { [description: string]: string } | undefined, convertTwoByteToOneByte: boolean): string | null {
private createExtendedStr(extended: { [description: string]: string } | undefined, convertDBStr: boolean): string | null {
if (typeof extended === 'undefined') { return null; }

let str = '';
Expand All @@ -292,7 +292,7 @@ abstract class ProgramsDB extends DBTableBase implements ProgramsDBInterface {
}
}

const ret = StrUtil.toDBStr(str, convertTwoByteToOneByte).trim();
const ret = StrUtil.toDBStr(str, convertDBStr).trim();

return ret;
}
Expand Down Expand Up @@ -755,7 +755,7 @@ abstract class ProgramsDB extends DBTableBase implements ProgramsDBInterface {
// あいまい検索
const likeStr = this.createLikeStr(keyOption.cs);
// tslint:disable-next-line:no-irregular-whitespace
const keywords = StrUtil.toDBStr(keyword, this.config.getConfig().convertTwoByteToOneByte).trim().split(/ | /);
const keywords = StrUtil.toDBStr(keyword, this.config.getConfig().convertDBStr).trim().split(/ | /);
const keywordCnt = keywords.length;

keywords.forEach((str, i) => {
Expand Down

0 comments on commit f0dea38

Please sign in to comment.