Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
opensipkd-hitung
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 68a4c64e
authored
May 10, 2020
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Tambah generator Nomor Transaksi Pemda
1 parent
8782e2fe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
0 deletions
.gitignore
CHANGES.txt
opensipkd/string/transaction_id.py
.gitignore
View file @
68a4c64
dist
build
*.egg-info
__pycache__
CHANGES.txt
View file @
68a4c64
0.1.6 2020-05-03
----------------
- Baru, class TransactionID untuk pembuatan Nomor Transaksi Pemda (NTP)
0.1.5 2020-04-23
----------------
- Bug fixed DateTimeVar.get_value() dan TimeVar.get_value()
...
...
opensipkd/string/transaction_id.py
0 → 100644
View file @
68a4c64
from
time
import
time
from
random
import
randrange
# Untuk Nomor Transaksi Pemda
class
TransactionID
:
def
__init__
(
self
,
timeout
=
3
):
self
.
timeout
=
timeout
def
create
(
self
,
prefix
=
''
):
awal
=
time
()
while
True
:
acak
=
randrange
(
0
,
99999999
)
tid
=
prefix
+
str
(
acak
)
.
zfill
(
8
)
if
not
self
.
is_found
(
tid
):
return
tid
if
time
()
-
awal
>
3
:
raise
Exception
(
'Timeout saat membuat Transaction ID'
)
# Override, please
def
is_found
(
self
,
tid
):
pass
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment