         detail:
           tasks: tasks
       window.dispatchEvent event
-    prevHours = curHours
+    prevDay = curDay
   handleTaskInfo: (e) ->
     {tasks} = e.detail
     @setState

        tasks: tasks
    window.dispatchEvent event
  refreshDay: ->
    curHours = (new Date()).getUTCHours()
    return if prevHours == curHours
    # UTC 20:00 -> Beijing 4:00 -> Tokyo 5:00
    if prevHours <= 19 and curHours >= 20
      {tasks} = @state
      for task, idx in tasks
        continue if task.id == 100000
        if task.type in [2, 4, 5]
          tasks[idx] =
            name: '未接受'
            id: 100000
            content: '...'
            progress: ''
            category: 0
            type: 0
        if task.type is 3 and (new Date()).getUTCDay() is 0
          tasks[idx] =
            name: '未接受'
            id: 100000
            content: '...'
            progress: ''
            category: 0
            type: 0
      tasks = _.sortBy tasks, (e) ->
        e.id
      @setState

  componentDidMount: ->
    window.addEventListener 'game.response', @handleResponse
    window.addEventListener 'task.info', @handleTaskInfo
    @interval = setInterval @refreshDay, 30000
  componentWillUnmount: ->
    window.removeEventListener 'game.response', @handleResponse
    window.removeEventListener 'task.info', @handleTaskInfo
    clearInterval @interval
  render: ->
    <Panel header="任务" bsStyle="success">
      <Table>
