Skip to content

Instantly share code, notes, and snippets.

{-# OPTIONS_GHC -cpp -fglasgow-exts #-}
{-# LANGUAGE CPP #-}
#include "gadts.h"
module Darcs.Repository.Cache (
cacheHash, okayHash, takeHash,
Cache(..), CacheType(..), CacheLoc(..), WritableOrNot(..),
HashedDir(..), hashedDir,
unionCaches, unionRemoteCaches, cleanCaches, cleanCachesWithHint,
{-# OPTIONS_GHC -cpp -fglasgow-exts #-}
{-# LANGUAGE CPP #-}
#include "gadts.h"
module Darcs.Repository.Cache (
cacheHash, okayHash, takeHash,
Cache(..), CacheType(..), CacheLoc(..), WritableOrNot(..),
HashedDir(..), hashedDir,
unionCaches, unionRemoteCaches, cleanCaches, cleanCachesWithHint,
-- Copyright (C) 2005 Tomasz Zielonka
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2, or (at your option)
-- any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[ERROR] /home/abuiles/odesk/Siva-Odesk/cospin/src/main/scala/com/cospin/rest/CampaignREST.scala:25: error: constructor cannot be instantiated to expected type;
[INFO] found : Some[A]
[INFO] required: Boolean
[INFO] case Some(userId) => {
[INFO] ^
[ERROR] /home/abuiles/odesk/Siva-Odesk/cospin/src/main/scala/com/cospin/rest/CampaignREST.scala:28: error: not found: value userId
[INFO] val campaign = new Campaign(userId,
[INFO] ^
[ERROR] two errors found
abuiles@abuiles-laptop:~/odesk/Siva-Odesk/cospin$ mvn scala:compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.cospin.rest:cospin:war:1.0-SNAPSHOT
[INFO] task-segment: [scala:compile]
[INFO] ------------------------------------------------------------------------
[INFO] [scala:compile {execution: default-cli}]
[INFO] Checking for multiple versions of scala
[INFO] /home/abuiles/odesk/Siva-Odesk/cospin/src/main/scala:-1: info: compiling
[INFO] Compiling 8 source files to /home/abuiles/odesk/Siva-Odesk/cospin/target/classes at 1280284911680
Given a "task group" with name: 123-identifier, account: the account, and the following "task group workers":
| WorkerId |
| 23333 |
| 423233 |
Given a task group exists with name: "image_moderation", account: the account
And another task group exists with name: "video_moderation", account: the account
When I login with "[email protected]", "password"
Then I should see "Your tasks"
Then I should see the "task_groups" table:
| Identifier | Type |
| image_moderation | Simple |
| video_moderation | Simple |
Given the following task group exists with:
| name | account |
| image_moderation | the account |
| video_moderation | the account |
And the following task group workers exist:
| turk_worker_id | trusted | task_group |
| A26KYPW8H33TR9 | false | the 1st task group |
| B26KYPW8H33TR9 | false | the 2nd task group |
And the following completions exist:
| task_group_worker |
Then I should see the "task_groups" table:
| Identifier | Type | Completed | Average Completion Time | Workers | Trusted Workers |
| image_moderation | Simple | 4 | 0:1:0 | 2 | 1 |
| video_moderation | Simple | 3 | 0:0:30 | 1 | 0 |
def self.average_task_price(identifier,account)
tasks = Task.find(:all, :conditions => {:identifier => identifier , :account_id => account.id})
size = tasks.size
if size > 0
totalPrice = completions.inject(0) {|val, tasks| val + task.price.to_f }
total/size.to_f
else
0
end
end