Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Kaffeekasse 2000XT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lehrstuhl für Informatik 4 (Systemsoftware)
PASST
Projekte
Kaffeekasse 2000XT
Commits
7f21fcc7
Commit
7f21fcc7
authored
5 years ago
by
Fabian Krüger
Browse files
Options
Downloads
Patches
Plain Diff
update backend: now supporting getLastChargesList
parent
4097f9df
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
store/backend.py
+17
-0
17 additions, 0 deletions
store/backend.py
store/store_config.py
+4
-1
4 additions, 1 deletion
store/store_config.py
with
21 additions
and
1 deletion
store/backend.py
+
17
−
0
View file @
7f21fcc7
...
...
@@ -194,3 +194,20 @@ class PurchaseLogic:
user
.
updateMoney
(
purchase
.
price
)
print
(
"
user_id:
"
,
user
.
id
,
"
purchase_id:
"
,
purchase
.
id
,
"
user.money:
"
,
user
.
money
)
class
ChargeLogic
:
"""
Returns a list of the last charges of a specified user: [{
'
id
'
: ...,
'
amount
'
: ...}, Decimal(...,...)]
@param user_id: the id of the specified user
@config-param max_charges: Number of charges to be shown. Depends on N_LAST_CHARGES
"""
def
getLastChargesList
(
user_id
):
max_charges
=
config
[
'
N_LAST_CHARGES
'
]
charges
=
Charge
.
objects
.
filter
(
user
=
user_id
).
values
(
'
id
'
,
'
amount
'
)
if
max_charges
<
0
:
charges
=
list
(
charges
.
order_by
(
'
time_stamp
'
).
reverse
())
else
:
charges
=
list
(
charges
.
order_by
(
'
time_stamp
'
).
reverse
())[:
max_charges
]
return
charges
This diff is collapsed.
Click to expand it.
store/store_config.py
+
4
−
1
View file @
7f21fcc7
...
...
@@ -5,8 +5,10 @@ T_ANNULLABLE_PURCHASE_M: time of minutes a user has for a purchase to undo it
N_MOST_BOUGHT_PRODUCTS: number of products to be shown in
'
Häufig gekauft
'
T_MOST_BOUGHT_PRODUCTS_D: number of days in the past that are used as time intervall limit to search for
'
Häufig gekauft
'
N_USERS_LOGIN: number of users that should be shown in the users list in the login-screen. A negative number means
'
all users are selected
'
'
all users are selected
'
T_USERS_LOGIN_D: number of days in the past that are used as time intervall limit to search for users
N_LAST_CHARGES: number of charges that should be shown in
'
Letzte Aufladungen
'
. A negative number means
'
all users are
selected
'
"""
KAFFEEKASSE
=
{
'
N_LAST_BOUGHT_PRODUCTS
'
:
5
,
'
T_LAST_BOUGHT_PRODUCTS_D
'
:
30
,
...
...
@@ -15,4 +17,5 @@ KAFFEEKASSE = {'N_LAST_BOUGHT_PRODUCTS': 5,
'
T_MOST_BOUGHT_PRODUCTS_D
'
:
30
,
'
N_USERS_LOGIN
'
:
-
1
,
'
T_USERS_LOGIN_D
'
:
356
,
'
N_LAST_CHARGES
'
:
-
1
,
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment