Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
151 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package timelog | ||
|
||
class UsageController { | ||
|
||
def index() { | ||
def model = [:] | ||
def today = TimeEntry.today() | ||
model.today = today | ||
def all_users = User.findAllByEnabled(true).collect{ it.username.split('@')[0] } | ||
model.users_with_entry = [] | ||
model.users_without_entry = [] | ||
(0..7).each{ | ||
def users_with_entry | ||
model.users_with_entry[it] = listUsersWithEntry(today - (it)) | ||
model.users_without_entry[it] = all_users - model.users_with_entry[it] | ||
} | ||
return model | ||
} | ||
|
||
private def listUsersWithEntry = { date -> | ||
def time_entries = TimeEntry.withCriteria{ | ||
ge('entryDate',date) | ||
lt('entryDate',date+1) | ||
order('id','desc') | ||
} | ||
def users_with_entry = [] | ||
time_entries.each{ | ||
def name = it.createdBy.split('@')[0] | ||
if(!users_with_entry.contains(name)){ | ||
users_with_entry.add(name) | ||
} | ||
} | ||
return users_with_entry | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<%@ page import="timelog.User" %> | ||
<html> | ||
<head> | ||
<meta name='layout' content='user'/> | ||
<meta name='menu' content='Reports'/> | ||
</head> | ||
|
||
<body> | ||
<div class="page-header"> | ||
<div class="row"> | ||
<h3 class="span7">People with entries</h3> | ||
<h3 class="span7">People without entries</h3> | ||
</div> | ||
<div class="row"> | ||
<p class="span14"> | ||
<strong> | ||
<g:formatDate date="${today}" type="date" style="FULL"/> | ||
</strong> | ||
</p> | ||
</div> | ||
<div class="row"> | ||
<div class="span7"> | ||
<g:if test="${users_with_entry[0]}"> | ||
<div class="unstyled alert-message block-message success"> | ||
<g:each in="${users_with_entry[0]}" var="u"> | ||
${u} | ||
</g:each> | ||
</div> | ||
</g:if> | ||
<g:else> | ||
<div class="unstyled alert-message block-message error"> | ||
<p>No one has recorded an entry</p> | ||
</div> | ||
</g:else> | ||
</div> | ||
<div class="span7"> | ||
<g:if test="${users_without_entry[0]}"> | ||
<div class="unstyled alert-message block-message error"> | ||
<g:each in="${users_without_entry[0]}" var="u"> | ||
<strong>${u}</strong> | ||
</g:each> | ||
</div> | ||
</g:if> | ||
<g:else> | ||
<div class="unstyled alert-message block-message success"> | ||
<p>Everyone has recorded an entry</p> | ||
</div> | ||
</g:else> | ||
</div> | ||
</div> | ||
</div> | ||
<g:each in="${(1..7)}" var="i"> | ||
<g:if test="${users_with_entry[i]}"> | ||
<div class="row"> | ||
<p class="span14"> | ||
<strong> | ||
<g:formatDate date="${today - i}" type="date" style="FULL"/> | ||
</strong> | ||
</p> | ||
</div> | ||
<div class="row"> | ||
<div class="span7"> | ||
<g:if test="${users_with_entry[i]}"> | ||
<div class="unstyled alert-message block-message success"> | ||
<g:each in="${users_with_entry[i]}" var="u"> | ||
${u} | ||
</g:each> | ||
</div> | ||
</g:if> | ||
<g:else> | ||
<div class="unstyled alert-message block-message error"> | ||
<p>No one has recorded an entry</p> | ||
</div> | ||
</g:else> | ||
</div> | ||
<div class="span7"> | ||
<g:if test="${users_without_entry[i]}"> | ||
<div class="unstyled alert-message block-message error"> | ||
<g:each in="${users_without_entry[i]}" var="u"> | ||
<strong>${u}</strong> | ||
</g:each> | ||
</div> | ||
</g:if> | ||
<g:else> | ||
<div class="unstyled alert-message block-message success"> | ||
<p>Everyone has recorded an entry</p> | ||
</div> | ||
</g:else> | ||
</div> | ||
</div> | ||
<hr class="span14"/> | ||
</g:if> | ||
</g:each> | ||
</body> | ||
</html> |