コード例 #1
0
ファイル: calculation.py プロジェクト: asseym/bamboo
 def find(cls, dataset):
     """
     Return the calculations for given *dataset*.
     """
     return [mongo_remove_reserved_keys(record) for record in cls.collection.find({
         DATASET_ID: dataset[DATASET_ID],
     })]
コード例 #2
0
ファイル: calculation.py プロジェクト: asseym/bamboo
        except ParseError, err:
            # do not save record, return error
            return {ERROR: err}

        record = {
            DATASET_ID: dataset[DATASET_ID],
            cls.FORMULA: formula,
            cls.NAME: name,
        }
        cls.collection.insert(record)

        # invalidate summary ALL since we have a new column
        stats = dataset.get(STATS)
        if stats:
            del stats[ALL]
            del dataset[STATS]
            Dataset.update(dataset, {STATS: stats})

        # call remote calculate and pass calculation id
        calculate_column.delay(dataset, dframe, formula, name)
        return mongo_remove_reserved_keys(record)

    @classmethod
    def find(cls, dataset):
        """
        Return the calculations for given *dataset*.
        """
        return [mongo_remove_reserved_keys(record) for record in cls.collection.find({
            DATASET_ID: dataset[DATASET_ID],
        })]