Skip to content

Commit

Permalink
Tracking pull request to merge release-2.4.0 to master (#2112)
Browse files Browse the repository at this point in the history
* new 2.4.0 release

* update pr number

* Bump django from 3.2.17 to 3.2.18 in /backend

Bumps [django](https://github.com/django/django) from 3.2.17 to 3.2.18.
- [Release notes](https://github.com/django/django/releases)
- [Commits](django/django@3.2.17...3.2.18)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* tfrs-2090-Refactor Schedule Summary Frontend Component

* TFRS-2084- Added transaction ID to CT pages

* TFRS-2104- Updated disclaimer for CR and ER

* fix: django warning fixes

* fix: jest tests fixed for new versions

* chore: updated eslint config and fixes

* fix: lint rule fix, reference fixes

* TFRS-2012- Updated missing PropTypes

* TFRS-2061- File Submission tab bugfix

* update knps (#2139)

* TFRS-2012- Fixed some minor warnings

* increase clamav resource allocation (#2146)

* unit test for schedulesummary container

* updating description

* Fixed original and current status

* fixing dashboard filter

* TFRS-2116- Fixed filters on compl & Exclu reports

* updating exclusion report filter for dashboard

* adding unit test for complianceReporting

* Fixed misplaced code

* chore: start of part3 summary tests

* chore: moved part3 tests directory, cleanup

* chore: style fixing

* chore: lint fix

* fix: unit tests and refactor schedule summary fixes

* fix: fixed input handling on schedule summary

* TFRS-2103 - Added new penalty for price of carbon

* TFRS-2149 - Fixed Schedule D Validation Error

* unit test for compliance report

* removing logging

* dashboard filter update

* Minor fix

* Fixed suppl reports not to be shown at dif filters

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jig-patel <[email protected]>
Co-authored-by: vibhishan <[email protected]>
Co-authored-by: Alex Zorkin <[email protected]>
Co-authored-by: AlexZorkin <[email protected]>
  • Loading branch information
6 people committed Mar 20, 2023
1 parent fe82570 commit 25ea57f
Show file tree
Hide file tree
Showing 130 changed files with 18,270 additions and 3,039 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tfrs-release.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
## For each release, the value of name, branches, RELEASE_NAME and PR_NUMBER need to be adjusted accordingly
## For each release, update lib/config.js: version and releaseBranch

name: TFRS release-2.3.0
name: TFRS release-2.4.0

on:
push:
branches: [ release-2.3.0 ]
branches: [ release-2.4.0 ]
workflow_dispatch:
workflow_call:

env:
## The pull request number of the Tracking pull request to merge the release branch to main
## Also remember to update the version in .pipeline/lib/config.js
PR_NUMBER: 2097
RELEASE_NAME: release-2.3.0
PR_NUMBER: 2112
RELEASE_NAME: release-2.4.0

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
4 changes: 2 additions & 2 deletions .pipeline/lib/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const options= require('@bcgov/pipeline-cli').Util.parseArguments()
const changeId = options.pr //aka pull-request
const version = '2.3.0'
const version = '2.4.0'
const name = 'tfrs'
const ocpName = 'apps.silver.devops'

Expand All @@ -13,7 +13,7 @@ options.git.repository='tfrs'
const phases = {
build: { namespace:'0ab226-tools' , name: `${name}`, phase: 'build' , changeId:changeId, suffix: `-build-${changeId}` ,
instance: `${name}-build-${changeId}` , version:`${version}-${changeId}`, tag:`build-${version}-${changeId}`,
releaseBranch: 'release-2.3.0'
releaseBranch: 'release-2.4.0'
},
dev: {namespace:'0ab226-dev' , name: `${name}`, phase: 'dev' , changeId:changeId, suffix: `-dev` ,
instance: `${name}-dev` , version:`${version}`, tag:`dev-${version}`, dbServiceName: 'tfrs-spilo',
Expand Down
23 changes: 23 additions & 0 deletions backend/api/migrations/0203_auto_20230312_0823.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.18 on 2023-03-12 08:23

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api', '0202_create_user_login_history'),
]

operations = [
migrations.AlterField(
model_name='scheduledsheetinput',
name='description',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='scheduledsheetinput',
name='value',
field=models.CharField(blank=True, max_length=255, null=True),
),
]
4 changes: 2 additions & 2 deletions backend/api/models/ComplianceReportSchedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ class ScheduleDSheetInput(Commentable):
db_comment="Spreadsheet cell address"
)
value = models.CharField(
max_length=100,
max_length=255,
blank=True,
null=True,
db_comment="Value entered in spreadsheet cell"
Expand All @@ -701,7 +701,7 @@ class ScheduleDSheetInput(Commentable):
db_comment="Unit (eg percent, L) of value in spreadsheet cell"
)
description = models.CharField(
max_length=100,
max_length=255,
blank=True,
null=True,
db_comment="Description or purpose of the value"
Expand Down
6 changes: 5 additions & 1 deletion backend/api/serializers/ComplianceReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ def get_summary(self, obj):
net_diesel_class_transferred = Decimal(0)

lines = {}
created_on = obj.create_timestamp.year

if obj.summary is not None:
lines['6'] = obj.summary.gasoline_class_retained \
Expand Down Expand Up @@ -604,7 +605,10 @@ def get_summary(self, obj):
lines['25'] = lines['23'] - lines['24']
lines['27'] = lines['25'] + lines['26']

lines['28'] = (lines['27'] * Decimal('-200.00')).max(Decimal(0))
if created_on < 2023:
lines['28'] = (lines['27'] * Decimal('-200.00')).max(Decimal(0))
else:
lines['28'] = (lines['27'] * Decimal('-600.00')).max(Decimal(0))

total_payable = lines['11'] + lines['22'] + lines['28']

Expand Down
6 changes: 4 additions & 2 deletions backend/api/serializers/Document.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,21 @@ class DocumentSerializer(serializers.ModelSerializer):
"""
Default Serializer for Documents
"""
create_user = UserMinSerializer(read_only=True)
type = DocumentTypeSerializer(read_only=True)
status = DocumentStatusSerializer(read_only=True)
credit_trades = CreditTradeAuxiliarySerializer(many=True, read_only=True)
history = DocumentHistorySerializer(many=True, read_only=True)

class Meta:
model = Document
fields = (
'id', 'title', 'status', 'type', 'create_timestamp', 'create_user',
'milestone', 'update_timestamp', 'update_user', 'credit_trades')
'milestone', 'update_timestamp', 'update_user', 'credit_trades', 'history')

read_only_fields = (
'id', 'title', 'status', 'type', 'create_timestamp', 'create_user',
'milestone', 'update_timestamp', 'update_user', 'credit_trades')
'milestone', 'update_timestamp', 'update_user', 'credit_trades', 'history')


class DocumentCreateSerializer(serializers.ModelSerializer):
Expand Down
40 changes: 40 additions & 0 deletions backend/api/tests/test_get_summary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from unittest import TestCase
from decimal import Decimal
from datetime import datetime
from api.serializers.ComplianceReport import ComplianceReportDetailSerializer
from unittest.mock import MagicMock, Mock


class TestComplianceReportDetailSerializer(TestCase):
def setUp(self):
self.serializer = ComplianceReportDetailSerializer()
self.serializer.summary = None

self.serializer.schedule_a = MagicMock(
net_gasoline_class_transferred=Decimal('10'),
net_diesel_class_transferred=Decimal('20')
)
self.serializer.schedule_b = MagicMock(
total_petroleum_diesel=Decimal('30'),
total_petroleum_gasoline=Decimal('40'),
total_renewable_diesel=Decimal('50'),
total_renewable_gasoline=Decimal('60'),
total_credits=Decimal('70'),
total_debits=Decimal('80')
)
self.serializer.schedule_c = MagicMock(
total_petroleum_diesel=Decimal('90'),
total_petroleum_gasoline=Decimal('100'),
total_renewable_diesel=Decimal('110'),
total_renewable_gasoline=Decimal('120')
)

def test_get_summary_for_year_lt_2023(self):
self.serializer.create_timestamp = Mock(year=2022)
result = self.serializer.get_summary(self.serializer)['total_payable']
self.assertEqual(result, Decimal('2000.00'))

def test_get_summary_for_year_gt_2022(self):
self.serializer.create_timestamp = Mock(year=2023)
result = self.serializer.get_summary(self.serializer)['total_payable']
self.assertEqual(result, Decimal('6000.00'))
Loading

0 comments on commit 25ea57f

Please sign in to comment.