Skip to content

Commit

Permalink
Merge 8cad8b0 into c68a39b
Browse files Browse the repository at this point in the history
  • Loading branch information
oriolpiera committed Mar 25, 2024
2 parents c68a39b + 8cad8b0 commit 5233d3b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/som_generation_integration_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
# For example, pypy2 and pypy3
fail-fast: false
matrix:
python-version: [ "2.7", "3.10" ]
#python-version: [ "2.7", "3.10" ] # Waiting for GISCE to finish Py3
python-version: [ "2.7" ]
services:
postgres:
image: timescale/timescaledb-postgis:latest-pg12
Expand Down
11 changes: 8 additions & 3 deletions som_generationkwh/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from dateutil.relativedelta import relativedelta
from tools.translate import _
from mongodb_backend.mongodb2 import mdbpool
import pytz

from generationkwh.sharescurve import MemberSharesCurve
from generationkwh.rightspershare import RightsPerShare
Expand Down Expand Up @@ -159,11 +160,15 @@ def _hourly_rights_generationkwh(self, cursor, uid, partner_id, start_date=None,

@staticmethod
def _prepare_datetime_value_www_response(dict_with_data):
# https://stackoverflow.com/questions/8777753/converting-datetime-date-to-utc-timestamp-in-python/8778548#8778548
cet = pytz.timezone('CET')
utc = pytz.timezone('UTC')
return [
{
'date': int(
mktime(datetime.strptime(k, '%Y-%m-%d %H:%M:%S').timetuple())
)*1000, # javascript works with 3 more 0 than python
'date': (
datetime.strptime(k, '%Y-%m-%d %H:%M:%S').replace(tzinfo=cet)
- datetime(1970, 1, 1, tzinfo=utc)
).total_seconds()*1000, # javascript works with 3 more 0 than python
'value': dict_with_data[k]
} for k in sorted(dict_with_data)
]
Expand Down
10 changes: 5 additions & 5 deletions som_generationkwh/tests/investment_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,7 @@ def test__create_divestment_invoice__withouProfitGKWH(self):
p=partner_data,
num_soci= partner_data.ref[1:],
investment_id=investment_id,
mandate_id=False,
mandate_id=mandate_id,
gkwh_account_code=gkwh_account_dict['code'],
gkwh_account_name=gkwh_account_dict['name'],
liq_account_code=liq_account_dict['code'],
Expand Down Expand Up @@ -2111,7 +2111,7 @@ def test__create_divestment_invoice__withProfitOneYearOkGKWH(self):
p=partner_data,
num_soci= partner_data.ref[1:],
investment_id=investment_id,
mandate_id=False,
mandate_id=mandate_id,
purchase_date=investment.purchase_date,
last_effective_date=investment.last_effective_date,
gkwh_account_code=gkwh_account_dict['code'],
Expand Down Expand Up @@ -2245,7 +2245,7 @@ def test__create_divestment_invoice__withProfitTwoYears_irpNotRoundedOkGKWH(self
p=partner_data,
num_soci= partner_data.ref[1:],
investment_id=investment_id,
mandate_id=False,
mandate_id=mandate_id,
purchase_date=investment.purchase_date,
last_effective_date=investment.last_effective_date,
gkwh_account_code=gkwh_account_dict['code'],
Expand Down Expand Up @@ -2382,7 +2382,7 @@ def test__create_divestment_invoice__withProfitTwoYears_okGKWH(self):
p=partner_data,
num_soci= partner_data.ref[1:],
investment_id=investment_id,
mandate_id=False,
mandate_id=mandate_id,
purchase_date=investment.purchase_date,
last_effective_date=investment.last_effective_date,
gkwh_account_code=gkwh_account_dict['code'],
Expand Down Expand Up @@ -2470,7 +2470,7 @@ def test__create_divestment_invoice__APO(self):
p=partner_data,
num_soci=partner_data.ref[1:],
investment_id=investment_id,
mandate_id=False,
mandate_id=mandate_id,
apo_account_name=apo_account_dict['name'],
apo_account_code=apo_account_dict['code'],
liq_account_code=liq_account_dict['code'],
Expand Down

0 comments on commit 5233d3b

Please sign in to comment.