Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
siscon-cli
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bernardo Sunderhus
siscon-cli
Commits
9907e6b0
Commit
9907e6b0
authored
Oct 02, 2017
by
Bernardo Sunderhus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adicionando hora default ao cadastrar tarefa
parent
89759c84
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
package.json
package.json
+1
-1
questions.ts
src/constants/questions.ts
+10
-1
index.ts
src/views/ponto/saida/index.ts
+1
-3
No files found.
package.json
View file @
9907e6b0
{
"name"
:
"siscon-cli"
,
"version"
:
"0.0.
1
"
,
"version"
:
"0.0.
2
"
,
"description"
:
"siscon-cli"
,
"main"
:
"./siscon-cli.js"
,
"bin"
:
{
...
...
src/constants/questions.ts
View file @
9907e6b0
...
...
@@ -46,6 +46,14 @@ export async function describeTask (): Promise<string> {
return
response
.
description
}
function
timeToString
(
time
:
number
)
{
const
hours
=
Math
.
floor
(
time
/
60
)
const
hoursStr
=
hours
?
hours
+
'h'
:
''
const
minutes
=
time
%
60
const
minutesStr
=
minutes
?
minutes
+
'min'
:
''
return
`
${
hoursStr
}${(
hours
&&
minutes
)
?
' '
:
''
}${
minutesStr
}
`
}
export
async
function
timeTask
(
time
:
number
)
{
const
totalHours
=
Math
.
floor
(
time
/
60
)
const
totalMinutes
=
time
%
60
...
...
@@ -53,7 +61,8 @@ export async function timeTask (time: number) {
const
response
=
await
prompt
({
type
:
'input'
,
name
:
'string'
,
message
:
`Tempo gasto na tarefa, até o máximo de
${
chalk
.
underline
.
bold
.
italic
.
blue
(
`
${
totalHours
}
h
${
totalMinutes
}
min`
)}
:`
,
default
:
timeToString
(
time
),
message
:
`Tempo gasto na tarefa:`
,
validate
:
(
input
=>
{
if
(
!
input
.
trim
())
return
chalk
.
red
(
'Tempo é obrigatório'
)
const
[,
hours
]
=
input
.
match
(
/
(\d
*
)
h/
)
||
[
undefined
,
0
]
...
...
src/views/ponto/saida/index.ts
View file @
9907e6b0
...
...
@@ -18,9 +18,7 @@ const Table: any = require('cli-table')
export
default
async
function
saida
(
dominio
:
Domain
,
ultimoRegistro
:
RegistroPonto
,
registro
:
RegistroPonto
,
ucRegistrarPonto
:
UcRegistrarPonto
)
{
if
(
!
(
await
prompt
(
exit
)).
exit
)
return
let
timeElapsedInMinutes
=
Math
.
floor
(
moment
(
registro
.
_DataRegistro
).
diff
(
ultimoRegistro
.
_DataRegistro
)
/
(
1000
*
60
))
const
hours
=
Math
.
floor
(
timeElapsedInMinutes
/
60
)
const
minutes
=
timeElapsedInMinutes
%
60
console
.
log
(
`
${
chalk
.
cyan
(
'!'
)}
Ponto de entrada realizado à
${
blue
.
underline
.
bold
.
italic
(
hours
+
'h '
+
minutes
+
'min'
)}
`
)
console
.
log
(
`
${
chalk
.
cyan
(
'!'
)}
Ponto de entrada realizado à
${
cyan
.
underline
.
bold
.
italic
(
timeToString
(
timeElapsedInMinutes
))}
`
)
const
spinner
=
makeSpinner
()
const
tabelaRegistros
=
new
Table
({
head
:
[
'Projeto'
,
'Tarefa'
,
'Descrição'
,
'Tempo'
]})
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment