Skip to content

Commit 54fa94b

Browse files
committed
Added cost rounding
1 parent dfd5744 commit 54fa94b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

projects/wonder_flowers/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ <h1>Доставка цветов</h1>
9696
</p>
9797
<p>
9898
При совмещении нескольких заказов стоимость каждого последующего заказа рассчитывается как:<br>
99-
<mark>cost = 5 * duration</mark>
99+
<mark>cost = max(100, 5 * duration)</mark>
100100
</p>
101101
<p>
102102
<mark>cost</mark> - стоимость доставки<br>
103-
<mark>duration</mark> - продолжительность доставки в минутах в одну сторону
103+
<mark>duration</mark> - продолжительность доставки в минутах в одну сторону<br>
104+
Стоимость доставки всегда кратна <mark>10</mark>, округление происходит в ближайшую сторону
104105
</p>
105106
</div>
106107
</div>

projects/wonder_flowers/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Vue.component('calc-item', {
2929
},
3030
computed: {
3131
cost: function () {
32-
return this.duration * 5
32+
return Math.round(Math.max(this.duration * 5, 100) /10) * 10
3333
}
3434
},
3535
methods: {
@@ -58,7 +58,7 @@ var app = new Vue({
5858
},
5959
computed: {
6060
cost: function () {
61-
return Math.round(450 + Math.atan((this.duration - 30) / 20) * 230)
61+
return Math.round((450 + Math.atan((this.duration - 30) / 20) * 230) / 10) * 10
6262
},
6363
totalDuration: function () {
6464
return this.duration + this.additionalDuration

0 commit comments

Comments
 (0)