Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) added new logics for operator and working time, also fixed tests #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backend/src/core/beautifier/beautifier_tzb.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ def parse_row(self, row: Series) -> Dict[str, str]:
return {
"phone_number": str(row["num"]).replace(" ", ""),
"region": row["REGION"],
"operator": row["OPERATOR"],
"operator": row["Оператор сотовой связи"],
"Пол": row["Пол"],
"Возраст": row["Возраст"],
"iSayMail": row["iSayMail"],
"Reward": row["Reward"],
"Source": row["Source"],
"Source": row["Source"]
}

def check_if_region_is_ignored(self, tailored_row: Dict[str, str]) -> bool:
Expand Down Expand Up @@ -101,8 +101,8 @@ def make_tailored_row(self, parsed_row: Dict[str, str]) -> Dict[str, str]:
"TimeDifference": self.get_time_difference(region),
"Region": region_code,
"Operator": operator_code,
"CallIntervalBegin": interval["begin"],
"CallIntervalEnd": interval["end"],
"CallIntervalBegin": "10:00:00",
"CallIntervalEnd": "22:00:00",
"Group": self.get_tzb_group(region, operator, parsed_row["Source"]),
"CHECK": self.get_external_id(phone_number),
"Mark": self.get_tzb_mark(region_code, operator_code),
Expand Down
8 changes: 8 additions & 0 deletions backend/src/tests/beautifier/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def row_simple() -> Series:
"IdRegion": 83,
"IdOper": 28,
"REGION": "Свердловская обл.",
"Оператор сотовой связи": 'ООО "ЕКАТЕРИНБУРГ-2000"',
"OPERATOR": 'ООО "ЕКАТЕРИНБУРГ-2000"',
"Пол": "Ж",
"Возраст": 30,
Expand All @@ -28,6 +29,7 @@ def row_simple_source_two() -> Series:
"IdRegion": 83,
"IdOper": 28,
"REGION": "Свердловская обл.",
"Оператор сотовой связи": 'ООО "ЕКАТЕРИНБУРГ-2000"',
"OPERATOR": 'ООО "ЕКАТЕРИНБУРГ-2000"',
"Пол": "Ж",
"Возраст": 30,
Expand All @@ -46,6 +48,7 @@ def row_for_nonexistent_region() -> Series:
"IdRegion": 83,
"IdOper": 28,
"REGION": "Волчий край",
"Оператор сотовой связи": 'ООО "ЕКАТЕРИНБУРГ-2000"',
"OPERATOR": 'ООО "ЕКАТЕРИНБУРГ-2000"',
"Пол": "Ж",
"Возраст": 30,
Expand All @@ -64,6 +67,7 @@ def row_for_chukotka() -> Series:
"IdRegion": 104,
"IdOper": 78,
"REGION": "Чукотский АО",
"Оператор сотовой связи": 'ПАО "Вымпел-Коммуникации"',
"OPERATOR": 'ПАО "Вымпел-Коммуникации"',
"Пол": "Ж",
"Возраст": 30,
Expand All @@ -82,6 +86,7 @@ def row_for_motiv() -> Series:
"IdRegion": 83,
"IdOper": 28,
"REGION": "Курганская обл.",
"Оператор сотовой связи": 'ООО "ЕКАТЕРИНБУРГ-2000"',
"OPERATOR": 'ООО "ЕКАТЕРИНБУРГ-2000"',
"Пол": "Ж",
"Возраст": 30,
Expand All @@ -100,6 +105,7 @@ def row_for_yota_moscow() -> Series:
"IdRegion": 83,
"IdOper": 28,
"REGION": "г. Москва * Московская область",
"Оператор сотовой связи": 'ООО "Скартел"',
"OPERATOR": 'ООО "Скартел"',
"Пол": "Ж",
"Возраст": 30,
Expand All @@ -118,6 +124,7 @@ def row_for_yota_krasnodar_kray() -> Series:
"IdRegion": 83,
"IdOper": 28,
"REGION": "Краснодарский край",
"Оператор сотовой связи": 'ООО "Скартел"',
"OPERATOR": 'ООО "Скартел"',
"Пол": "Ж",
"Возраст": 30,
Expand All @@ -136,6 +143,7 @@ def row_for_sim_telecom() -> Series:
"IdRegion": 83,
"IdOper": 28,
"REGION": "Краснодарский край",
"Оператор сотовой связи": 'ООО "СИМ ТЕЛЕКОМ"',
"OPERATOR": 'ООО "СИМ ТЕЛЕКОМ"',
"Пол": "Ж",
"Возраст": 30,
Expand Down
4 changes: 2 additions & 2 deletions backend/src/tests/beautifier/test_beautifier_tzb.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ def test_make_tailored_row_for_tzb(row_simple):
"TimeDifference": "UTC +5",
"Region": 12,
"Operator": 7,
"CallIntervalBegin": "08:00:00",
"CallIntervalEnd": "20:00:00",
"CallIntervalBegin": "10:00:00",
"CallIntervalEnd": "22:00:00",
"Group": "Свердловская область_Мотив_iSay",
"CHECK": "9001979228",
"Mark": "12_7",
Expand Down
11 changes: 10 additions & 1 deletion backend/src/utils/config_storage/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,16 @@
"Мотив": "Мотив",
"Другой оператор": "Другие",
"СберМобайл": "Другие",
"Теле-2": "Теле-2"
"Теле-2": "Теле-2",
"UNKNOWN": "Неизвестный",
"MTS": "МТС",
"MEGAFON": "МегаФон",
"BEELINE": "Билайн",
"TELE2": "Теле-2",
"YOTA": "Йота",
"OTHER": "Другие",
"MOTIV": "Мотив",
"TINKOFF": "Другие"
},
"operator_codes": {
"МТС": 1,
Expand Down