Skip to content

Commit

Permalink
Change social status to special service everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Oct 3, 2024
1 parent bf05b24 commit 3bc1072
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def handle(self, *args, **options):
"cif": ngo.registration_number,
"account": ngo.bank_account.upper(),
"years_checkmark": False,
"special_status": ngo.is_social_service_viable,
"is_social_service_viable": ngo.is_social_service_viable,
}

donor.pdf_file = File(create_pdf(donor_dict, ngo_dict))
Expand Down
2 changes: 1 addition & 1 deletion backend/donations/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def get(self, request, ngo_url, *args, **kwargs):
# do not add any checkmark on this form regarding the number of years
"years_checkmark": False,
# "two_years": False,
"special_status": ngo.is_social_service_viable,
"is_social_service_viable": ngo.is_social_service_viable,
}
donor = {
# we assume that ngos are looking for people with income from wages
Expand Down
2 changes: 1 addition & 1 deletion backend/donations/views/my_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def post(self, request, *args, **kwargs):
ngo.address = post.get("ong-adresa", "").strip()
ngo.county = post.get("ong-judet", "").strip()
ngo.active_region = post.get("ong-activitate", "").strip()
ngo.is_social_service_viable = True if post.get("special-status") == "on" else False
ngo.is_social_service_viable = True if post.get("social-service") == "on" else False

if registration_number_errors:
errors.append(registration_number_errors)
Expand Down
2 changes: 1 addition & 1 deletion backend/donations/views/ngo.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def get_post_value(arg, add_to_error_list=True):
"account": ngo.bank_account.upper(),
"cif": ngo.registration_number,
"two_years": two_years,
"special_status": ngo.is_social_service_viable,
"is_social_service_viable": ngo.is_social_service_viable,
"percent": "3,5%",
}

Expand Down
2 changes: 1 addition & 1 deletion backend/static_extras/css/main.css

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions backend/static_extras/css/my-account.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// border-bottom: 1px dotted @input-border;
#ong-details-form #ong-url;
width: 90%;
&:focus {
&:focus {
border-top: 1px dotted @body-bg;
}
}
Expand All @@ -38,7 +38,7 @@
.choose-url-group {
margin-top: 50px;
}

#ong-url {
cursor: pointer;
display: inline;
Expand All @@ -54,7 +54,7 @@
background-color: initial;
}
}

#ngo-logo {
max-height: 150px;
}
Expand All @@ -65,16 +65,16 @@
resize: vertical;
}

.special-status {
.social-service {
margin-top: 50px;

.special-status-explanation {
.social-service-explanation {
font-weight: normal;
margin-top: 10px;
}
}

.special-status {
.social-service {
.explanation {
font-weight: normal;
}
Expand All @@ -94,4 +94,4 @@
text-align: center;
font-size: 14px;

}
}
8 changes: 4 additions & 4 deletions backend/templates/v1/components/ngo-details-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ <h2>Date financiare</h2>
<input type="text" class="form-control" id="ong-cont" value="{{ ngo.bank_account if ngo }}" name="ong-cont" placeholder="Codul IBAN" x-moz-errormessage="Codul IBAN" title="Codul IBAN" required maxlength="40"/>
</div>
</div>
<div class="form-group special-status">
<div class="form-group social-service">
<div class="col-xs-4 text-right">
<input id="special-status" name="special-status" type="checkbox" {{ "checked" if ngo and ngo.has_special_status }} {% if has_ngohub %}disabled{% endif %}>
<input id="social-service" name="social-service" type="checkbox" {{ "checked" if ngo and ngo.is_social_service_viable }} {% if has_ngohub %}disabled{% endif %}>
</div>
<label for="special-status" class="col-xs-8">
<label for="social-service" class="col-xs-8">
Asociație înregistrată ca furnizor autorizat de servicii sociale
</label>
</div>
<div class="form-group special-status">
<div class="form-group social-service">
<div class="col-xs-4 text-right">
<input id="accepts-forms" name="accepts-forms" type="checkbox" {{ "checked" if ngo and ngo.is_accepting_forms }}>
</div>
Expand Down
26 changes: 19 additions & 7 deletions local_tools/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import csv
import logging
import os
import time
from pathlib import Path
from typing import Any, List

import time
from google.cloud import datastore
from google.cloud.datastore import Client as DsClient, Entity, Query

Expand All @@ -24,7 +24,7 @@
"iterations": -1,
"webapp_to_django": {
"key.name": "slug",
"special_status": "has_special_status",
"special_status": "is_social_service_viable",
"description": "description",
"name": "name",
"account": "bank_account",
Expand Down Expand Up @@ -158,7 +158,10 @@ def write_query_data_to_csv(csv_name, current_kind, items):
except KeyError:
value = getattr(item, split_parameters[0])
except AttributeError:
if "default_values" in current_kind and split_parameters[0] not in current_kind["default_values"]:
if (
"default_values" in current_kind
and split_parameters[0] not in current_kind["default_values"]
):
raise KeyError(
f"Key '{split_parameters[0]}' not found in item {item} and no default value provided."
)
Expand All @@ -175,9 +178,14 @@ def write_query_data_to_csv(csv_name, current_kind, items):
else:
value = getattr(value, parameter)

if "hard_stop" in current_kind and composed_parameter == current_kind["hard_stop"]["output_field"]:
if (
"hard_stop" in current_kind
and composed_parameter == current_kind["hard_stop"]["output_field"]
):
compare_value = current_kind["hard_stop"]["value"]
if eval(f"{value} {current_kind['hard_stop']['operator']} {compare_value}"):
if eval(
f"{value} {current_kind['hard_stop']['operator']} {compare_value}"
):
logger.info(
f"Hard stop condition met for {composed_parameter} with comparison:"
f"[ {value} {current_kind['hard_stop']['operator']} {compare_value} ]"
Expand Down Expand Up @@ -216,7 +224,9 @@ def retrieve_data(csv_name, kind_data):
offset: int = 0
iterations: int = kind_data["iterations"]

logger.info(f"Retrieving data for {kind_data['name']} a batch of {limit} for {iterations} iterations.")
logger.info(
f"Retrieving data for {kind_data['name']} a batch of {limit} for {iterations} iterations."
)

runs = 0
num_items = 0
Expand All @@ -232,7 +242,9 @@ def retrieve_data(csv_name, kind_data):
break

if len(items) < limit:
logger.info(f"–– Retrieved {num_items} items of type {kind_data['name']} after {runs + 1} runs.")
logger.info(
f"–– Retrieved {num_items} items of type {kind_data['name']} after {runs + 1} runs."
)
break

offset += limit
Expand Down

0 comments on commit 3bc1072

Please sign in to comment.