Skip to content

Commit

Permalink
Merge pull request #361 from bcgov/release-v0.2.0
Browse files Browse the repository at this point in the history
Release v0.2.0.4
  • Loading branch information
kuanfandevops committed Jun 8, 2018
2 parents 6f7c0a7 + edcb5e0 commit 51ed4b6
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 27 deletions.
Empty file added backend/api/scripts/__init__.py
Empty file.
48 changes: 48 additions & 0 deletions backend/api/scripts/update_effective_dates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from api.models.CreditTrade import CreditTrade
from api.models.CreditTradeHistory import CreditTradeHistory
from api.models.CreditTradeStatus import CreditTradeStatus


def run():
status_approved = CreditTradeStatus.objects \
.get(status="Approved")

status_completed = CreditTradeStatus.objects \
.get(status="Completed")

# Get all completed credit transfers
credit_trades = CreditTrade.objects.filter(
status_id=status_completed.id).order_by('-id')

for credit_trade in credit_trades:
'''
as we loop through the completed credit trades,
look at the history, and check what the last effective was
before it was completed
'''
credit_trade_history = CreditTradeHistory.objects.filter(
credit_trade_id=credit_trade.id,
status_id=status_approved.id
).order_by('-update_timestamp', '-id').first()

if credit_trade_history:
credit_trade_history_complete = CreditTradeHistory.objects.filter(
credit_trade_id=credit_trade.id,
status_id=status_completed.id
).order_by('-update_timestamp', '-id').first()

if credit_trade_history_complete.trade_effective_date != \
credit_trade_history.trade_effective_date and \
credit_trade_history.trade_effective_date is not None:
'''
Update the history that has a status completed
so it uses the that effective date
'''
credit_trade_history_complete.trade_effective_date = \
credit_trade_history.trade_effective_date
credit_trade_history_complete.save()

# Update the credit trade
credit_trade.trade_effective_date = \
credit_trade_history.trade_effective_date
credit_trade.save()
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const HistoricalDataEntryPage = (props) => {
id="confirmProcess"
title="Confirm Process"
>
Are you sure you want to commit the approved credit transfers?
Are you sure you want to commit the approved credit transactions?
</Modal>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class Navbar extends Component {
<img src="/assets/images/menu-open-mobile.png" alt="menu" />
</button>
</div>
<div className="col-sm-6 col-md-6 col-lg-6 hidden-xs">
<div className="col-sm-5 col-md-6 col-lg-6 hidden-xs">
<div className="bcgov-title">
<h1>Transportation Fuels Reporting System</h1>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CreditTransferTextRepresentation extends Component {
this.numberOfCredits = numeral(this.props.numberOfCredits).format(NumberFormat.INT);
this.totalValue = numeral(this.props.totalValue).format(NumberFormat.CURRENCY);
this.tradeEffectiveDate = (this.props.tradeEffectiveDate)
? moment(this.props.tradeEffectiveDate).format('LL') : 'approval';
? moment(this.props.tradeEffectiveDate).format('LL') : "on director's approval";

this.tradeStatus = (this.props.status.id === CREDIT_TRANSFER_STATUS.approved.id ||
this.props.status.id === CREDIT_TRANSFER_STATUS.completed.id)
Expand All @@ -39,7 +39,7 @@ class CreditTransferTextRepresentation extends Component {
<span className="value"> {this.numberOfCredits} </span> credit{(this.props.numberOfCredits > 1) && 's'} from
<span className="value"> {this.creditsFrom} </span>
for <span className="value"> {this.totalValue} </span>
effective on <span className="value"> {this.tradeEffectiveDate}</span>.
effective <span className="value"> {this.tradeEffectiveDate}</span>.
</div>
);
}
Expand All @@ -51,7 +51,7 @@ class CreditTransferTextRepresentation extends Component {
<span className="value"> {this.numberOfCredits} </span> credit{(this.props.numberOfCredits > 1) && 's'} for
<span className="value"> {this.creditsTo} </span>
has been <span className="value lowercase"> {this.tradeStatus} </span>
effective on <span className="value"> {this.tradeEffectiveDate}</span>.
effective <span className="value"> {this.tradeEffectiveDate}</span>.
</div>
);
}
Expand All @@ -64,7 +64,7 @@ class CreditTransferTextRepresentation extends Component {
credit{(this.props.numberOfCredits > 1) && 's'} earned by
<span className="value"> {this.creditsTo} </span> for the completion of a
Part 3 Agreement has been <span className="value lowercase"> {this.tradeStatus}</span>,
effective on <span className="value"> {this.tradeEffectiveDate}</span>.
effective <span className="value"> {this.tradeEffectiveDate}</span>.
</div>
);
}
Expand All @@ -77,7 +77,7 @@ class CreditTransferTextRepresentation extends Component {
credit{(this.props.numberOfCredits > 1) && 's'} earned by
<span className="value"> {this.creditsFrom} </span>
has been <span className="value lowercase"> {this.tradeStatus}</span>,
effective on <span className="value"> {this.tradeEffectiveDate}</span>.
effective <span className="value"> {this.tradeEffectiveDate}</span>.
</div>
);
}
Expand All @@ -103,7 +103,7 @@ class CreditTransferTextRepresentation extends Component {
credit{(this.props.numberOfCredits > 1) && 's'} earned by
<span className="value"> {this.creditsTo} </span>
has been <span className="value lowercase"> {this.tradeStatus}</span>,
effective on <span className="value"> {this.tradeEffectiveDate}</span>.
effective <span className="value"> {this.tradeEffectiveDate}</span>.
</div>
);
}
Expand Down
46 changes: 27 additions & 19 deletions frontend/styles/CreditTransfers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

.credit-transfer-progress-bar {
padding: 1rem 2rem 1rem 0rem;
padding: 1rem 0rem 1rem 0rem;

@include mobile {
padding: 1rem 0;
Expand Down Expand Up @@ -84,24 +84,22 @@
@include mobile {
width: 100%;
}
}

.step:after,
.step:before {
content: " ";
position: absolute;
top: 0;
right: -17px;
width: 0;
height: 0;
border-top: 19px solid transparent;
border-bottom: 17px solid transparent;
border-left: 17px solid $border-grey;
z-index: 2;
transition: border-color 0.2s ease;

@include mobile {
content: none;
&:after,
&:before {
content: " ";
position: absolute;
top: 0;
right: -17px;
width: 0;
height: 0;
border-top: 19px solid transparent;
border-bottom: 17px solid transparent;
border-left: 17px solid $border-grey;
z-index: 2;
transition: border-color 0.2s ease;
@include mobile {
content: none;
}
}
}

Expand All @@ -121,6 +119,16 @@
border-bottom-left-radius: 4px;
}

.step:last-child {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
&:after {
border-top: none;
border-bottom: none;
border-left: none;
}
}

.step span {
position: relative;
}
Expand Down

0 comments on commit 51ed4b6

Please sign in to comment.