Add a new review at once
2609
protected function submitAddReview()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('review');
        $this->addReview();
    }
355799
function insertRating(rating, config, conn) {


  // validate
  if ( (!rating.uri || rating.uri === '') && (!rating.cacheURI || rating.cacheURI === '') ) {
    return 'You must enter a valid uri'
  }
  if (!rating.reviewer || rating.reviewer === '') {
    return 'You must enter a valid reviewer'
  }

  // defaults
  config = config || require('../config/config.js')


  // main
  return new Promise((resolve, reject) => {

    if (!conn) {
      var conn = wc_db.getConnection(config.db)
    }

    var sql
    if (rating.uri) {
      sql = 'INSERT into Rating values (NULL, :uri, :rating, NULL, :reviewer, NULL, NOW())'
    } else {
      sql = 'INSERT into Rating SELECT NULL, a.uri, :rating, NULL, :reviewer, NULL, NOW() from Media a where a.cacheURI = :cacheURI '
    }
    debug('insertRating', sql, rating)

    conn.query(sql, { replacements: { "uri" : rating.uri, "cacheURI" : rating.cacheURI, "reviewer" : rating.reviewer, "rating" : rating.rating ? rating.rating : null } }).then(function(ret){
      return resolve({"ret" : ret, "conn" : conn})
    }).catch(function(err) {
      return reject({"err" : err, "conn" : conn})
    })

  })

}
452406
def update(postid, userid, rating):
        '''
        
        '''
        rating_recs = TabRating.select().where(
            (TabRating.post_id == postid) & (TabRating.user_id == userid)
        )
        if rating_recs.count() > 0:
            MRating.__update_rating(rating_recs.get().uid, rating)
        else:
            MRating.__insert_data(postid, userid, rating)
804829
protected function addOrderCheckout()
    {
        $submitted = $this->getSubmittedOrderCheckout();
        $result = $this->order_action->add($submitted, array('admin' => $this->admin));
        $this->finishOrderCheckout($result);
    }
676056
def response_add(self, request, obj, post_url_continue=POST_URL_CONTINUE):
        
        if '_addanother' not in request.POST and '_popup' not in request.POST:
            request.POST['_continue'] = 1
        return super(ExportAdmin, self).response_add(request,
                                                     obj,
                                                     post_url_continue)
695663
def refresh(self):
        
        super().refresh()
        self._html = None
        self._title = None
        self._details = None
        self._answer_num = None
        self._follower_num = None
        self._topics = None
        self._last_edit_time = None
        self._logs = None
527301
def add_response(self, req, resp):
        
        if self._cache is None:
            return
        signature = sign(req.checkRequest)
        with self._cache as c:
            now = self._timer()
            quota_scale = 0  # WIP
            item = c.get(signature)
            if item is None:
                c[signature] = CachedItem(
                    resp, self.service_name, now, quota_scale)
            else:
                # Update the cached item to reflect that it is updated
                item.last_check_time = now
                item.response = resp
                item.quota_scale = quota_scale
                item.is_flushing = False
                c[signature] = item
604749
public function EditReview()
    {
        $oGlobal = TGlobal::instance();
        $oMsgManager = TCMSMessageManager::GetInstance();
        if ($oGlobal->UserDataExists(TdbShopArticleReview::URL_PARAM_REVIEW_ID) && $oGlobal->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) {
            $oEditReview = TdbShopArticleReview::GetNewInstance();
            if ($oEditReview->Load($oGlobal->GetUserData(TdbShopArticleReview::URL_PARAM_REVIEW_ID))) {
                $aUserData = $oGlobal->GetuserData(TdbShopArticleReview::INPUT_BASE_NAME);
                foreach ($aUserData as $sKey => $sValue) {
                    $oEditReview->sqlData[$sKey] = $sValue;
                }
                if ($this->ValidateWriteReviewData($oEditReview->sqlData)) {
                    $oEditReview->AllowEditByAll(true);
                    $oEditReview->Save();
                    $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-EDIT-REVIEW-SUCCESS');
                }
            } else {
                $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-REVIEW-NOT-FOUND');
            }
        } else {
            $oMsgManager->AddMessage(self::MSG_CONSUMER_NAME, 'ARTICLE-REVIEW-ACTION-MISSING-PARAMETER');
        }
    }
1119298
def review(self):
        """"""
        return PostCollection([p for p in self if p.status == Status.review])
160539
def add_check(self, check_item):
        """"""
        self.checks.append(check_item)
        for other in self.others:
            other.add_check(check_item)
422564
def write_feedback(self, feedback, cr=True):
		
		self.__previous_data += feedback
		if cr is True:
			self.__previous_data += '\n'
1189993
def insert_check(self, index, check_item):
        """"""
        self.checks.insert(index, check_item)
        for other in self.others:
            other.insert_check(index, check_item)
366602
def _append(self, menu):
        ''''''
        menu.AppendCheckItem(self.id(), self.name, self.description)
        menu.Check(self.id(), self.checked)
824
protected function addReview()
    {
        if (!$this->isError()) {
            $id = $this->review->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
757708
def add(self, submission, archive, _):
        
        self.queue.put((submission, submission["result"], submission["grade"], submission["problems"], submission["tests"], submission["custom"], archive))
699081
def publish_if_new(cls):
    """"""
    message = cls.make_message()
    if message != cls.last_message:
      super(DashboardPubSub, cls).publish(message)
      cls.last_message = message
662495
public function addReviews(ReviewCollection $reviews)
    {
        foreach ($reviews as $review) {
            $this->reviews->append($review);
        }

        return $this;
    }