Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
becskasszasch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
DevTeam
becskasszasch
Commits
aef01032
Commit
aef01032
authored
1 year ago
by
Réthelyi Bálint
Browse files
Options
Downloads
Plain Diff
Merge branch 'kasszasch' into 'master'
fix credits See merge request
!28
parents
b080177d
38ab16d4
No related branches found
No related tags found
1 merge request
!28
fix credits
Pipeline
#45076
passed
1 year ago
Stage: build
Stage: docker
Stage: deploy
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
db/db.go
+6
-2
6 additions, 2 deletions
db/db.go
homepage/new.go
+1
-1
1 addition, 1 deletion
homepage/new.go
with
7 additions
and
3 deletions
db/db.go
+
6
−
2
View file @
aef01032
...
...
@@ -331,8 +331,6 @@ func (u *User) Load() error {
return
e
}
const
credit
=
5000
func
SaveMultipleSpend
(
sp
[]
*
Spend
)
error
{
e
:=
db
.
RunInTransaction
(
context
.
Background
(),
func
(
tx
*
pg
.
Tx
)
error
{
for
_
,
s
:=
range
sp
{
...
...
@@ -349,6 +347,12 @@ func SaveMultipleSpend(sp []*Spend) error {
}
e
=
tx
.
Model
(
u
)
.
WherePK
()
.
First
()
var
credit
int64
if
u
.
Credits
>
5000
{
credit
=
u
.
Credits
}
else
{
credit
=
5000
}
price
:=
p
.
Price
*
s
.
Amount
if
price
>
u
.
Money
+
credit
{
return
fmt
.
Errorf
(
"Not enough funds"
)
...
...
This diff is collapsed.
Click to expand it.
homepage/new.go
+
1
−
1
View file @
aef01032
...
...
@@ -95,7 +95,7 @@ func NewHandler(w http.ResponseWriter, r *http.Request) {
}
var
credit
int64
if
session
.
User
.
Credits
>
0
{
if
session
.
User
.
Credits
>
500
0
{
credit
=
session
.
User
.
Credits
}
else
{
credit
=
5000
...
...
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