Skip to content

Instantly share code, notes, and snippets.

@philipusis
philipusis / gist:74514ce69797f1a4d93daf4831c4a239
Last active October 30, 2017 17:04
Формат вывода для Radio и MultipleChoise
{
//Среднее значение (только для Radio)
average: <Number>,
//Распределение ответов по процентам
distribution: [
{
value: <Number>,
text: <string>,
percentage: <Number>
}
@philipusis
philipusis / gist:7015f998db4122c57928e3febbb4655f
Created October 30, 2017 16:53
Формат вывода данных по аналитике
{
dataSetId: <int>, //или guid
data: [
{
questionId: <Number>,
text: <string>,
inquirerId: <Number>,
inquirerName: <string>,
questionTypeId: <Number>
data: [
public ActionResult Index()
{
IndexModel model = new IndexModel();
model.PsyUserVacancyStatus = EnumObjects.GetPsyUserVacancyStatus(Language.Russian);
model.DownloadPath = downloadPath;
model.PsyTestUser = unitOfWork.PsyTestUser.GetPsyTestUser(currUser.PsyTestUserId);
model.Vacancies = unitOfWork.Vacancy.GetVacanciesByUser(currUser.PsyTestUserId);
model.PsyTestLinks = unitOfWork.PsyTestLink.GetPsyTestLinksByUser(currUser.PsyTestUserId);
List<int> ids = model.PsyTestLinks.Select(x => x.InquirerId).ToList();
model.Inquirers = unitOfWork.Inquirer.GetInquirersByIds(ids, currUser.PsyTestUserId, Language.Russian);
public string GetUserAvatar(int userId)
{
var avatar = Directory.EnumerateFiles(Path.Combine(ftpServerPath, "UserAvatars"))
.Where(x => Path.GetFileNameWithoutExtension(x) == userId.ToString());
if (avatar.Count() != 0)
{
return String.Format("{0}{1}/{2}", downloadPath, "UserAvatars", Path.GetFileName(avatar.First()));
}
else
{
<div class="recruitment-block" style="width: 38%;">
@using (Ajax.BeginForm("ApplicantPartial", null, new AjaxOptions {HttpMethod = "GET", UpdateTargetId = "applicant"}, new {id = "applicantsForm"}))
{
@Html.Hidden("selectedVacancyId")
@Html.Hidden("selectedApplicantId")
<script type="text/javascript">
function SearchApplicants() {
var search = $("#searchApplicants").val();
$("#applicants .recruitment-block__applicant-item").show();
if (search.length > 0) {
<? $j = 0; foreach($arResult["complexParams"]["FL_TOURTAGS"] as $tag): ?>
<? if ($j < 10 ):?>
<div class="tag tag-id-<?=$tag["T_TYPE"]?> <?if(in_array($tag["T_TYPE"], $arResult["customParams"]["FL_TOURTAGS"])) {?> selected<?}?>" data-id="<?=$tag["T_TYPE"]?>" data-weight="50000" oldvalue="<?=$tag["TTYPE_NAME"]?>"><?=$tag["TTYPE_NAME"]?></div>
<? $j++; endif; ?>
<? endforeach; ?>
switch ($serviceClass) {
case 'must_to_buy':
show_like_must_to_buy($arParams, $arResult, $serviceArray, $h2 = 'Обязательно к покупке', $serviceClass);
break;
case 2:
case 4:
default:
if($serviceClass == 2) {
$h2 = "Трансферы";
} elseif($serviceClass == 4) {
for(j = 0; j < fieldData.length; j++) {
if ( j < 10 ) {
// some code...
}
}
var result = '';
var params = ["foo", "bar"];
$.each(params, function(index, value) {
result += (result ? ',' : '') + value;
});
modules.define('attach', ['i-bem-dom', 'button'], function(provide, bemDom, Button) {
provide(bemDom.declBlock(this.name, {
onSetMod: {
'js': {
'inited' : function(modName, modVal) {
this._button = this.findChildBlock(Button);
}
}
}