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

Fix/remaining claims #168

Merged
merged 2 commits into from
Oct 29, 2023
Merged
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
12 changes: 6 additions & 6 deletions authentication/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Meta:

class ProfileSerializer(serializers.ModelSerializer):
wallets = WalletSerializer(many=True, read_only=True)
total_round_claims_remaining = serializers.SerializerMethodField()
# total_round_claims_remaining = serializers.SerializerMethodField()
token = serializers.SerializerMethodField()

class Meta:
Expand All @@ -65,18 +65,18 @@ class Meta:
"initial_context_id",
"is_meet_verified",
"is_aura_verified",
"total_round_claims_remaining",
# "total_round_claims_remaining",
"wallets",
]

def get_token(self, instance):
token, bol = Token.objects.get_or_create(user=instance.user)
return token.key

def get_total_round_claims_remaining(self, instance):
gs = GlobalSettings.objects.first()
if gs is not None:
return gs.gastap_round_claim_limit - LimitedChainClaimManager.get_total_round_claims(instance)
# def get_total_round_claims_remaining(self, instance):
# gs = GlobalSettings.objects.first()
# if gs is not None:
# return gs.gastap_round_claim_limit - LimitedChainClaimManager.get_total_round_claims(instance)


class SimpleProfilerSerializer(serializers.ModelSerializer):
Expand Down
2 changes: 1 addition & 1 deletion faucet/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def get(self, request, *args, **kwargs):
user_profile = request.user.profile
gs = GlobalSettings.objects.first()
if gs is not None:
result = gs.gastap_round_claim_limit - LimitedChainClaimManager.get_total_round_claims(user_profile)
result = max(gs.gastap_round_claim_limit - LimitedChainClaimManager.get_total_round_claims(user_profile), 0)
return Response({"total_round_claims_remaining": result}, status=200)
else:
raise Http404("Global Settings Not Found")
Expand Down