mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-29 14:19:48 -04:00
Add student total playtime to ClassroomView
This commit is contained in:
parent
055a6f7eeb
commit
3fefdfa0a7
3 changed files with 15 additions and 2 deletions
app
styles/courses
templates/courses
views/courses
|
@ -2,6 +2,9 @@
|
|||
#main-button-area
|
||||
.btn
|
||||
margin-left: 10px
|
||||
|
||||
#student-stats-row
|
||||
margin-bottom: 20px
|
||||
|
||||
.progress
|
||||
margin-bottom: 5px
|
||||
|
|
|
@ -35,8 +35,13 @@ block content
|
|||
|
||||
h2= user.broadName()
|
||||
- var lastPlayedString = view.makeLastPlayedString(user);
|
||||
if lastPlayedString
|
||||
p Last Played: #{lastPlayedString}
|
||||
- var playtime = view.makePlaytimeString(user);
|
||||
if lastPlayedString || playtime
|
||||
#student-stats-row.row
|
||||
if lastPlayedString
|
||||
.col-sm-6 Last Played: #{lastPlayedString}
|
||||
if playtime
|
||||
.col-sm-6 Playtime: #{playtime}
|
||||
|
||||
- var paidFor = user.get('coursePrepaidID');
|
||||
for courseInstance in view.courseInstances.models
|
||||
|
|
|
@ -122,6 +122,11 @@ module.exports = class ClassroomView extends RootView
|
|||
campaignLevel = campaign.get('levels')[levelOriginal]
|
||||
return "#{campaign.get('fullName')}, #{campaignLevel.name}"
|
||||
|
||||
makePlaytimeString: (user) ->
|
||||
playtime = _.reduce user.sessions.pluck('playtime'), (s1, s2) -> (s1 or 0) + (s2 or 0)
|
||||
return '' unless playtime
|
||||
return moment.duration(playtime, 'seconds').humanize()
|
||||
|
||||
onClickAddStudentsButton: (e) ->
|
||||
modal = new InviteToClassroomModal({classroom: @classroom})
|
||||
@openModalView(modal)
|
||||
|
|
Loading…
Add table
Reference in a new issue