Skip to content

Commit

Permalink
feat(clans): add dates to 10 days report
Browse files Browse the repository at this point in the history
  • Loading branch information
Hojagulyyev committed Dec 7, 2023
1 parent a7cd08f commit c570910
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 6 deletions.
18 changes: 13 additions & 5 deletions apps/xps/templatetags/level_design.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import datetime

from django import template

from rp2.business_logic import LEVEL_STEP_THAT_CHANGE_COLOR_DESIGN
Expand Down Expand Up @@ -46,15 +48,21 @@ def get_level_color_by_level(level, gradient_index=0):
return get_level_color_by_color_index(color_index, gradient_index)


@register.filter(name='range_list')
def range_list(number):
return range(1, number + 1)


@register.filter(name="get_statistic_color_by_color_index")
def get_statistic_color_by_color_index(color_index):

if color_index > len(STATISTIC_COLOR_DESIGN):
color_index = list(STATISTIC_COLOR_DESIGN.keys())[-1]

return STATISTIC_COLOR_DESIGN[color_index]


@register.filter(name='range_list')
def range_list(number):
return range(1, number + 1)


@register.filter()
def remove_days(days):
new_date = datetime.date.today() - datetime.timedelta(days=days)
return new_date
10 changes: 10 additions & 0 deletions scripts/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# config
BASE_DIR="rp2"

# ansi
YELLOW='\e[0;33m'
RED='\033[0;31m';
LIGHT_RED='\033[1;31m';
GREEN='\033[0;32m';
LIGHT_GREEN='\033[1;32m';
NO_COLOR='\033[0m';
30 changes: 30 additions & 0 deletions scripts/git/git_merge_dev_push_main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

. scripts/env.sh

current_directory=$( pwd );
current_branch=$(git branch --show-current)

# ===== VALIDATION =====

if ! [ "$current_branch" == "dev" ]; then
printf "${YELLOW}The current branch must be dev${NO_COLOR}\n"
printf "${LIGHT_RED}Failed${NO_COLOR}\n"
return
fi

if ! [[ "$current_directory" == *$BASE_DIR ]]; then
printf "${YELLOW}The current directory must be $BASE_DIR${NO_COLOR}\n"
printf "${LIGHT_RED}Failed${NO_COLOR}\n"
return
fi

# ===== PROCESS =====

git checkout main
git pull origin main
git merge dev
git push origin main
git checkout dev

printf "${LIGHT_GREEN}Succeed${NO_COLOR}\n"
2 changes: 1 addition & 1 deletion templates/clans/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ <h2 class="section-title">Overview</h2>
canvas = el[0],
ctx = canvas.getContext('2d'),
chartData = {
labels: ['1', '2', '3', '4', '5', '6', '7', '8', 'yesterday', 'today', 'tomorrow'],
labels: ['{{ 9|remove_days }}', '{{ 8|remove_days }}', '{{ 7|remove_days }}', '{{ 6|remove_days }}', '{{ 5|remove_days }}', '{{ 4|remove_days }}', '{{ 3|remove_days }}', '{{ 2|remove_days }}', 'yesterday', 'today', 'tomorrow'],
datasets: [
{% for account in top_accounts %}
{
Expand Down

0 comments on commit c570910

Please sign in to comment.