Rename boolean explicit for is_explicit/isExplicit

This commit is contained in:
Reckless_Satoshi 2022-01-02 05:35:31 -08:00
parent c4b625a993
commit c71d95ccd0
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
5 changed files with 15 additions and 15 deletions

View File

@ -53,7 +53,7 @@ class Order(models.Model):
payment_method = models.CharField(max_length=30, null=False, default="Not specified")
premium = models.DecimalField(max_digits=5, decimal_places=2, default=0, null=True, validators=[MinValueValidator(-100), MaxValueValidator(999)])
satoshis = models.PositiveBigIntegerField(null=True, validators=[MinValueValidator(min_satoshis_trade), MaxValueValidator(max_satoshis_trade)])
explicit = models.BooleanField(default=False, null=False) # pricing method. A explicit amount of sats, or a relative premium above/below market.
is_explicit = models.BooleanField(default=False, null=False) # pricing method. A explicit amount of sats, or a relative premium above/below market.
# order participants
maker = models.ForeignKey(User, related_name='maker', on_delete=models.SET_NULL, null=True, default=None) # unique = True, a maker can only make one order

View File

@ -4,9 +4,9 @@ from .models import Order
class OrderSerializer(serializers.ModelSerializer):
class Meta:
model = Order
fields = ('id','status','created_at','type','currency','amount','payment_method','explicit','premium','satoshis','maker','taker')
fields = ('id','status','created_at','type','currency','amount','payment_method','is_explicit','premium','satoshis','maker','taker')
class MakeOrderSerializer(serializers.ModelSerializer):
class Meta:
model = Order
fields = ('type','currency','amount','payment_method','explicit','premium','satoshis')
fields = ('type','currency','amount','payment_method','is_explicit','premium','satoshis')

View File

@ -29,7 +29,7 @@ export default class MakerPage extends Component {
constructor(props) {
super(props);
this.state={
explicit: false,
isExplicit: false,
type: 0,
currency: this.defaultCurrency,
currencyCode: this.defaultCurrencyCode,
@ -74,14 +74,14 @@ export default class MakerPage extends Component {
}
handleClickRelative=(e)=>{
this.setState({
explicit: false,
isExplicit: false,
satoshis: null,
premium: 0,
});
}
handleClickExplicit=(e)=>{
handleClickisExplicit=(e)=>{
this.setState({
explicit: true,
isExplicit: true,
satoshis: 10000,
premium: null,
});
@ -97,7 +97,7 @@ export default class MakerPage extends Component {
currency: this.state.currency,
amount: this.state.amount,
payment_method: this.state.payment_method,
explicit: this.state.explicit,
is_explicit: this.state.isExplicit,
premium: this.state.premium,
satoshis: this.state.satoshis,
}),
@ -210,7 +210,7 @@ export default class MakerPage extends Component {
control={<Radio color="secondary"/>}
label="Explicit"
labelPlacement="Top"
onClick={this.handleClickExplicit}
onClick={this.handleClickisExplicit}
onShow="false"
/>
</RadioGroup>
@ -222,7 +222,7 @@ export default class MakerPage extends Component {
</FormControl>
</Grid>
{/* conditional shows either Premium % field or Satoshis field based on pricing method */}
{ this.state.explicit
{ this.state.isExplicit
? <Grid item xs={12} align="center">
<FormControl >
<TextField
@ -270,7 +270,7 @@ export default class MakerPage extends Component {
<Typography component="subtitle2" variant="subtitle2">
<div align='center'>
Create a BTC {this.state.type==0 ? "buy":"sell"} order for {this.state.amount} {this.state.currencyCode}
{this.state.explicit ? " of " + this.state.satoshis + " Satoshis" :
{this.state.isExplicit ? " of " + this.state.satoshis + " Satoshis" :
(this.state.premium == 0 ? " at market price" :
(this.state.premium > 0 ? " at a " + this.state.premium + "% premium":" at a " + -this.state.premium + "% discount")
)

View File

@ -11,7 +11,7 @@ export default class OrderPage extends Component {
is_participant: false,
amount: 1,
paymentMethod:"",
explicit: false,
isExplicit: false,
premium: 0,
satoshis: null,
makerId: "",
@ -33,7 +33,7 @@ export default class OrderPage extends Component {
currency: data.currency,
amount: data.amount,
paymentMethod: data.payment_method,
explicit: data.explicit,
isExplicit: data.is_explicit,
//premium: data.premium,
// satoshis: satoshis,
// makerId: maker,
@ -55,7 +55,7 @@ export default class OrderPage extends Component {
<p>Currency: {this.state.currencyCode}</p>
<p>Amount: {this.state.amount}</p>
<p>Payment method: {this.state.paymentMethod}</p>
<p>Pricing method is explicit: {this.state.explicit.toString()}</p>
<p>Pricing method is explicit: {this.state.isExplicit.toString()}</p>
{/* <p>Premium: {this.state.premium}</p>
<p>Maker: {this.makerId}</p> */}
</div>

File diff suppressed because one or more lines are too long