Skip to content

Commit

Permalink
chore: Update mission fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
khaitranquang committed May 2, 2024
1 parent 1795086 commit e39b599
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 9 deletions.
34 changes: 25 additions & 9 deletions locker_server/api_orm/fixtures/mission.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"model": "api_orm.Mission",
"model": "api_orm.MissionORM",
"fields": {
"id": "referral",
"title": "Referral",
Expand All @@ -16,7 +16,7 @@
}
},
{
"model": "api_orm.Mission",
"model": "api_orm.MissionORM",
"fields": {
"id": "extension_installation_and_review",
"title": "Extension Installation & Review",
Expand All @@ -32,7 +32,7 @@
}
},
{
"model": "api_orm.Mission",
"model": "api_orm.MissionORM",
"fields": {
"id": "desktop_app_installation",
"title": "Desktop App Installation",
Expand All @@ -48,7 +48,7 @@
}
},
{
"model": "api_orm.Mission",
"model": "api_orm.MissionORM",
"fields": {
"id": "app_store_rating_and_review",
"title": "App Store Rating & Review",
Expand All @@ -64,7 +64,7 @@
}
},
{
"model": "api_orm.Mission",
"model": "api_orm.MissionORM",
"fields": {
"id": "google_play_rating_and_review",
"title": "Google Play Rating & Review",
Expand All @@ -80,7 +80,7 @@
}
},
{
"model": "api_orm.Mission",
"model": "api_orm.MissionORM",
"fields": {
"id": "capterra_rating_and_review",
"title": "Capterra Rating & Review",
Expand All @@ -96,7 +96,7 @@
}
},
{
"model": "api_orm.Mission",
"model": "api_orm.MissionORM",
"fields": {
"id": "trustpilot_rating_and_review",
"title": "Trustpilot Rating & Review",
Expand All @@ -112,7 +112,7 @@
}
},
{
"model": "api_orm.Mission",
"model": "api_orm.MissionORM",
"fields": {
"id": "g2_rating_and_review",
"title": "G2 Rating & Review",
Expand All @@ -128,7 +128,7 @@
}
},
{
"model": "api_orm.Mission",
"model": "api_orm.MissionORM",
"fields": {
"id": "reddit_community_participation_and_review",
"title": "Reddit Community Participation & Review",
Expand All @@ -142,5 +142,21 @@
"reward_type": "promo_code",
"reward_value": 5
}
},
{
"model": "api_orm.MissionORM",
"fields": {
"id": "clutch_rating_and_review",
"title": "Clutch Rating & Review",
"description_en": "Review Locker on Clutch",
"description_vi": "Đánh giá Locker trên Clutch",
"created_time": 1714623790,
"mission_type": "review",
"order_index": 10,
"extra_requirements": null,
"available": false,
"reward_type": "promo_code",
"reward_value": 5
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import requests
from typing import Dict
from bs4 import BeautifulSoup

from locker_server.shared.constants.missions import REWARD_TYPE_PROMO_CODE
from locker_server.shared.external_services.user_reward_mission.mission import Mission


class ClutchRatingAndReviewMission(Mission):
def __init__(self, mission_type: str, extra_requirements=None):
super().__init__(mission_type=mission_type, extra_requirements=extra_requirements)
self.reward_type = REWARD_TYPE_PROMO_CODE
self.reward_value = 5

def check_mission_completion(self, input_data: Dict):
return False
url = f"https://clutch.co/profile/locker-password-manager?sort_by=date_desc#reviews"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.58",
}
res = requests.get(url=url, headers=headers)
if res.status_code != 200:
return False
content = res.text
soup = BeautifulSoup(content, features="html.parser")

0 comments on commit e39b599

Please sign in to comment.