mirror of
https://github.com/RoboSats/robosats.git
synced 2025-07-17 16:23:13 +00:00
Add lifetime settled volume. Sort admin panel cronologically
This commit is contained in:
@ -19,6 +19,7 @@ class EUserAdmin(UserAdmin):
|
|||||||
inlines = [ProfileInline]
|
inlines = [ProfileInline]
|
||||||
list_display = ('avatar_tag','id','username','last_login','date_joined','is_staff')
|
list_display = ('avatar_tag','id','username','last_login','date_joined','is_staff')
|
||||||
list_display_links = ('id','username')
|
list_display_links = ('id','username')
|
||||||
|
ordering = ('-id',)
|
||||||
def avatar_tag(self, obj):
|
def avatar_tag(self, obj):
|
||||||
return obj.profile.avatar_tag()
|
return obj.profile.avatar_tag()
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ class LNPaymentAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
|
|||||||
list_display_links = ('hash','concept')
|
list_display_links = ('hash','concept')
|
||||||
change_links = ('sender','receiver','order_made','order_taken','order_escrow','order_paid')
|
change_links = ('sender','receiver','order_made','order_taken','order_escrow','order_paid')
|
||||||
list_filter = ('type','concept','status')
|
list_filter = ('type','concept','status')
|
||||||
|
ordering = ('-expires_at',)
|
||||||
|
|
||||||
@admin.register(Profile)
|
@admin.register(Profile)
|
||||||
class UserProfileAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
|
class UserProfileAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
|
||||||
@ -49,9 +51,11 @@ class CurrencieAdmin(admin.ModelAdmin):
|
|||||||
list_display = ('id','currency','exchange_rate','timestamp')
|
list_display = ('id','currency','exchange_rate','timestamp')
|
||||||
list_display_links = ('id','currency')
|
list_display_links = ('id','currency')
|
||||||
readonly_fields = ('currency','exchange_rate','timestamp')
|
readonly_fields = ('currency','exchange_rate','timestamp')
|
||||||
|
ordering = ('id',)
|
||||||
|
|
||||||
@admin.register(MarketTick)
|
@admin.register(MarketTick)
|
||||||
class MarketTickAdmin(admin.ModelAdmin):
|
class MarketTickAdmin(admin.ModelAdmin):
|
||||||
list_display = ('timestamp','price','volume','premium','currency','fee')
|
list_display = ('timestamp','price','volume','premium','currency','fee')
|
||||||
readonly_fields = ('timestamp','price','volume','premium','currency','fee')
|
readonly_fields = ('timestamp','price','volume','premium','currency','fee')
|
||||||
list_filter = ['currency']
|
list_filter = ['currency']
|
||||||
|
ordering = ('-timestamp',)
|
10
api/views.py
10
api/views.py
@ -492,8 +492,18 @@ class InfoView(ListAPIView):
|
|||||||
avg_premium = 0
|
avg_premium = 0
|
||||||
total_volume = 0
|
total_volume = 0
|
||||||
|
|
||||||
|
queryset = MarketTick.objects.all()
|
||||||
|
if not len(queryset) == 0:
|
||||||
|
volume_settled = []
|
||||||
|
for tick in queryset:
|
||||||
|
volume_settled.append(tick.volume)
|
||||||
|
lifetime_volume_settled = int(sum(volume_settled)*100000000)
|
||||||
|
else:
|
||||||
|
lifetime_volume_settled = 0
|
||||||
|
|
||||||
context['today_avg_nonkyc_btc_premium'] = round(avg_premium,2)
|
context['today_avg_nonkyc_btc_premium'] = round(avg_premium,2)
|
||||||
context['today_total_volume'] = total_volume
|
context['today_total_volume'] = total_volume
|
||||||
|
context['lifetime_satoshis_settled'] = lifetime_volume_settled
|
||||||
context['lnd_version'] = get_lnd_version()
|
context['lnd_version'] = get_lnd_version()
|
||||||
context['robosats_running_commit_hash'] = get_commit_robosats()
|
context['robosats_running_commit_hash'] = get_commit_robosats()
|
||||||
context['fee'] = FEE
|
context['fee'] = FEE
|
||||||
|
@ -15,6 +15,11 @@ import EqualizerIcon from '@mui/icons-material/Equalizer';
|
|||||||
import SendIcon from '@mui/icons-material/Send';
|
import SendIcon from '@mui/icons-material/Send';
|
||||||
import PublicIcon from '@mui/icons-material/Public';
|
import PublicIcon from '@mui/icons-material/Public';
|
||||||
|
|
||||||
|
// pretty numbers
|
||||||
|
function pn(x) {
|
||||||
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
|
}
|
||||||
|
|
||||||
export default class BottomBar extends Component {
|
export default class BottomBar extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -27,6 +32,7 @@ export default class BottomBar extends Component {
|
|||||||
fee: 0,
|
fee: 0,
|
||||||
today_avg_nonkyc_btc_premium: 0,
|
today_avg_nonkyc_btc_premium: 0,
|
||||||
today_total_volume: 0,
|
today_total_volume: 0,
|
||||||
|
lifetime_satoshis_settled: 0,
|
||||||
};
|
};
|
||||||
this.getInfo();
|
this.getInfo();
|
||||||
}
|
}
|
||||||
@ -61,7 +67,7 @@ export default class BottomBar extends Component {
|
|||||||
>
|
>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Typography component="h5" variant="h5">Stats For Nerds</Typography>
|
<Typography component="h5" variant="h5">Stats For Nerds</Typography>
|
||||||
<List>
|
<List dense>
|
||||||
<Divider/>
|
<Divider/>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemIcon><BoltIcon/></ListItemIcon>
|
<ListItemIcon><BoltIcon/></ListItemIcon>
|
||||||
@ -84,6 +90,12 @@ export default class BottomBar extends Component {
|
|||||||
<ListItemText primary={this.state.today_total_volume+" BTC"} secondary="Today traded volume"/>
|
<ListItemText primary={this.state.today_total_volume+" BTC"} secondary="Today traded volume"/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
|
<Divider/>
|
||||||
|
<ListItem>
|
||||||
|
<ListItemIcon><EqualizerIcon/></ListItemIcon>
|
||||||
|
<ListItemText primary={pn(this.state.lifetime_satoshis_settled)+" Sats"} secondary="Lifetime settled volume"/>
|
||||||
|
</ListItem>
|
||||||
|
|
||||||
<Divider/>
|
<Divider/>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemIcon><PublicIcon/></ListItemIcon>
|
<ListItemIcon><PublicIcon/></ListItemIcon>
|
||||||
|
@ -147,11 +147,11 @@ export default class OrderPage extends Component {
|
|||||||
countdownPenaltyRenderer = ({ minutes, seconds, completed }) => {
|
countdownPenaltyRenderer = ({ minutes, seconds, completed }) => {
|
||||||
if (completed) {
|
if (completed) {
|
||||||
// Render a completed state
|
// Render a completed state
|
||||||
return (<span> nothing. Good to go!</span>);
|
return (<span> Penalty lifted, good to go!</span>);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<span>{zeroPad(minutes)}m {zeroPad(seconds)}s </span>
|
<span> Wait {zeroPad(minutes)}m {zeroPad(seconds)}s </span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -445,7 +445,7 @@ export default class OrderPage extends Component {
|
|||||||
<Divider />
|
<Divider />
|
||||||
<Grid item xs={12} align="center">
|
<Grid item xs={12} align="center">
|
||||||
<Alert severity="warning" sx={{maxWidth:360}}>
|
<Alert severity="warning" sx={{maxWidth:360}}>
|
||||||
You cannot take an order yet! Wait <Countdown date={new Date(this.state.penalty)} renderer={this.countdownPenaltyRenderer} />
|
You cannot take an order yet! <Countdown date={new Date(this.state.penalty)} renderer={this.countdownPenaltyRenderer} />
|
||||||
</Alert>
|
</Alert>
|
||||||
</Grid>
|
</Grid>
|
||||||
</>
|
</>
|
||||||
|
Reference in New Issue
Block a user