diff --git a/app/core/utils.coffee b/app/core/utils.coffee index 898497e42..9d063b2bf 100644 --- a/app/core/utils.coffee +++ b/app/core/utils.coffee @@ -131,6 +131,18 @@ module.exports.kindaEqual = compare = (l, r) -> else return false +# Return UTC string "YYYY-MM-DD" for today + offset +module.exports.getUTCDay = (offset=0) -> + # TODO: Move to utility + day = new Date() + day.setDate(day.getUTCDate() + offset) + partYear = day.getUTCFullYear() + partMonth = (day.getUTCMonth() + 1) + partMonth = "0" + partMonth if partMonth < 10 + partDay = day.getUTCDate() + partDay = "0" + partDay if partDay < 10 + "#{partYear}-#{partMonth}-#{partDay}" + # Fast, basic way to replace text in an element when you don't need much. # http://stackoverflow.com/a/4962398/540620 if document? diff --git a/app/locale/en.coffee b/app/locale/en.coffee index c0268d09f..f83f7252b 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -159,6 +159,10 @@ date: "Date" body: "Body" version: "Version" + pending: "Pending" + accepted: "Accepted" + rejected: "Rejected" + withdrawn: "Withdrawn" submitter: "Submitter" submitted: "Submitted" commit_msg: "Commit Message" diff --git a/app/locale/es-ES.coffee b/app/locale/es-ES.coffee index b0ef0dcff..be31ed7d6 100644 --- a/app/locale/es-ES.coffee +++ b/app/locale/es-ES.coffee @@ -145,13 +145,13 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis fork: "Bifurcar" play: "Jugar" # When used as an action verb, like "Play next level" retry: "Reintentar" -# actions: "Actions" + actions: "Acciones" # info: "Info" -# help: "Help" + help: "Ayuda" watch: "Mirar" unwatch: "Pasar" - submit_patch: "Mandar Parche" -# submit_changes: "Submit Changes" + submit_patch: "Enviar Parche" + submit_changes: "Enviar Cambios" general: and: "y" @@ -165,10 +165,10 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis # review: "Review" version_history: "Historial de versión" version_history_for: "Historial de las versiones de: " -# select_changes: "Select two changes below to see the difference." -# undo_prefix: "Undo" + select_changes: "Selecciona dos cambios más abajo para ver la diferencia." + undo_prefix: "Deshacer" # undo_shortcut: "(Ctrl+Z)" -# redo_prefix: "Redo" + redo_prefix: "Rehacer" # redo_shortcut: "(Ctrl+Shift+Z)" # play_preview: "Play preview of current level" result: "Resultado" @@ -233,7 +233,7 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis reload_title: "¿Recargar todo el código?" reload_really: "¿Estas seguro que quieres reiniciar el nivel?" reload_confirm: "Recargarlo todo" -# victory: "Victory" + victory: "Victoria" victory_title_prefix: "¡" victory_title_suffix: " Completado!" victory_sign_up: "Regístrate para recibir actualizaciones." @@ -246,8 +246,8 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis victory_review: "¡Cuéntanos más!" # Only in old-style levels. victory_hour_of_code_done: "¿Ya terminaste?" victory_hour_of_code_done_yes: "Si, ¡He terminado con mi hora de código!" -# victory_experience_gained: "XP Gained" -# victory_gems_gained: "Gems Gained" + victory_experience_gained: "XP Conseguida" + victory_gems_gained: "Gemas Conseguidas" guide_title: "Guía" tome_minion_spells: "Los hechizos de tus súbditos" # Only in old-style levels. tome_read_only_spells: "Hechizos de solo lectura" # Only in old-style levels. @@ -271,7 +271,7 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis loading_ready: "¡Listo!" loading_start: "Iniciar Nivel" problem_alert_title: "Arregla tu código" -# problem_alert_help: "Help" + problem_alert_help: "Ayuda" time_current: "Ahora:" time_total: "Máx:" time_goto: "Ir a:" @@ -304,7 +304,7 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis tip_talk_is_cheap: "Hablar es fácil. Enséñame el código. - Linus Torvalds" tip_first_language: "La cosa más desastrosa que puedes aprender es tu primer lenguaje de programación. - Alan Kay" tip_hardware_problem: "P: Cuantos programadores hacen falta para cambiar una bombilla? R: Ninguno, es un problema de hardware." -# tip_hofstadters_law: "Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law." + tip_hofstadters_law: "Ley de Hofstadter: Siempre lleva más tiempo de lo que esperas, incluso cuando tienes en cuenta la Ley de Hofstadter." tip_premature_optimization: "La optimizacion prematura es la raiz de todo mal. - Donald Knuth" tip_brute_force: "Cuando haya dudas, usa la fuerza bruta. - Ken Thompson" tip_extrapolation: "Existen solo dos clases de personas: aquellos que pueden extrapolar desde información incompleta..." diff --git a/app/locale/zh-HANS.coffee b/app/locale/zh-HANS.coffee index c0c693c2d..6b5a0483c 100644 --- a/app/locale/zh-HANS.coffee +++ b/app/locale/zh-HANS.coffee @@ -68,7 +68,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese change_hero: "重新选择英雄" # Go back from choose inventory to choose hero choose_inventory: "装备道具" buy_gems: "购买宝石" -# campaign_desert: "Desert Campaign" + campaign_desert: "沙漠战役" campaign_forest: "森林战役" campaign_dungeon: "地牢战役" subscription_required: "需订阅" @@ -106,9 +106,9 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese load_profile: "载入 G+ 档案" load_email: "载入 G+ 电子邮件" finishing: "完成..." -# sign_in_with_facebook: "Sign in with Facebook" -# sign_in_with_gplus: "Sign in with G+" -# signup_switch: "Want to create an account?" + sign_in_with_facebook: "Facebook账号登录" + sign_in_with_gplus: " G+ 账号登录" + signup_switch: "是否创建新账户?" signup: email_announcements: "通过邮件接收通知" @@ -117,7 +117,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese log_in: "登录" social_signup: "或者,你可以通过Facebook或G+注册:" required: "在做这件事情之前你必须先注册。" -# login_switch: "Already have an account?" + login_switch: "已经注册过账户?" recover: recover_account_title: "找回账户" @@ -145,13 +145,13 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese fork: "派生" play: "开始" # When used as an action verb, like "Play next level" retry: "重试" -# actions: "Actions" -# info: "Info" + actions: "行为" + info: "信息" help: "帮助" watch: "关注" unwatch: "取消关注" submit_patch: "提交补丁" -# submit_changes: "Submit Changes" + submit_changes: "提交更新" general: and: "与" @@ -159,18 +159,18 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese date: "日期" body: "正文" version: "版本" -# submitter: "Submitter" -# submitted: "Submitted" + submitter: "提交者" + submitted: "已提交" commit_msg: "提交信息" -# review: "Review" + review: "查看" version_history: "版本历史" version_history_for: "版本历史: " -# select_changes: "Select two changes below to see the difference." -# undo_prefix: "Undo" -# undo_shortcut: "(Ctrl+Z)" -# redo_prefix: "Redo" -# redo_shortcut: "(Ctrl+Shift+Z)" -# play_preview: "Play preview of current level" + select_changes: "选择下面两项更新来查看其不同。" + undo_prefix: "取消" + undo_shortcut: "(Ctrl+Z)" + redo_prefix: "重做" + redo_shortcut: "(Ctrl+Shift+Z)" + play_preview: "当前关卡预览" result: "结果" results: "结果" description: "描述" @@ -233,7 +233,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese reload_title: "重载所有代码?" reload_really: "确定重载这一关,返回开始处吗?" reload_confirm: "重载所有" -# victory: "Victory" + victory: "胜利" victory_title_prefix: "" victory_title_suffix: " 完成" victory_sign_up: "保存进度" @@ -246,8 +246,8 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese victory_review: "给我们反馈!" # Only in old-style levels. victory_hour_of_code_done: "你完成了吗?" victory_hour_of_code_done_yes: "是的, 完成了!" -# victory_experience_gained: "XP Gained" -# victory_gems_gained: "Gems Gained" + victory_experience_gained: "获得经验" + victory_gems_gained: "获得宝石" guide_title: "指南" tome_minion_spells: "助手的咒语" # Only in old-style levels. tome_read_only_spells: "只读的咒语" # Only in old-style levels. @@ -271,7 +271,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese loading_ready: "载入完成!" loading_start: "开战" problem_alert_title: "修正你的代码" -# problem_alert_help: "Help" + problem_alert_help: "帮助" time_current: "现在:" time_total: "最大:" time_goto: "跳到:" @@ -307,7 +307,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese tip_hofstadters_law: "侯世达定律:做事所花费的时间总是比你预期的要长,即使你的预期中考虑了侯世达定律。" tip_premature_optimization: "过早的优化是万恶之源。 - 高德纳" tip_brute_force: "拿不准时就用穷举法。 - Ken Thompson" -# tip_extrapolation: "There are only two kinds of people: those that can extrapolate from incomplete data..." + tip_extrapolation: "世界上只有两类人:一类人能够根据不完整的数据进行推断……" # tip_superpower: "Coding is the closest thing we have to a superpower." game_menu: @@ -315,8 +315,8 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese save_load_tab: "保存/打开" options_tab: "设置" guide_tab: "使用向导" -# guide_video_tutorial: "Video Tutorial" -# guide_tips: "Tips" + guide_video_tutorial: "视频教程" + guide_tips: "小技巧" multiplayer_tab: "多人游戏" auth_tab: "注册" inventory_caption: "装备你的英雄" @@ -330,7 +330,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese inventory: choose_inventory: "装备道具" equipped_item: "已装备" -# required_purchase_title: "Required" + required_purchase_title: "需要" available_item: "可用" restricted_title: "被限制" should_equip: "(双击装备此道具)" @@ -350,7 +350,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese prompt_title: "没有足够数量的宝石" prompt_body: "还需要更多吗?" prompt_button: "进入商店" -# recovered: "Previous gems purchase recovered. Please refresh the page." + recovered: "之前购买的宝石已恢复。请刷新页面。" subscribe: subscribe_title: "订阅" @@ -391,7 +391,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese regeneration: "恢复" range: "攻击范围" # As in "attack or visual range" blocks: "格挡" # As in "this shield blocks this much damage" -# backstab: "Backstab" # As in "this dagger does this much backstab damage" + backstab: "背刺" # As in "this dagger does this much backstab damage" skills: "技能" available_for_purchase: "可以购买" # Shows up when you have unlocked, but not purchased, a hero in the hero store level_to_unlock: "未解锁关卡:" # Label for which level you have to beat to unlock a particular hero (click a locked hero in the store to see) @@ -574,10 +574,10 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese classes: archmage_title: "大法师" archmage_title_description: "(代码编写人员)" -# archmage_summary: "If you are a developer interested in coding educational games, become an archmage to help us build CodeCombat!" + archmage_summary: "如果你是对教育类游戏感兴趣的开发者,那么就选择大法师来帮我们为 CodeCombat编写代码吧!" artisan_title: "工匠" artisan_title_description: "(关卡建立人员)" -# artisan_summary: "Build and share levels for you and your friends to play. Become an Artisan to learn the art of teaching others to program." + artisan_summary: "建立游戏关卡并分享给朋友们。那么就选择工匠职业来教其他人编程吧。" adventurer_title: "冒险家" adventurer_title_description: "(关卡测试人员)" # adventurer_summary: "Get our new levels (even our subscriber content) for free one week early and help us work out bugs before our public release." @@ -659,7 +659,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese # achievement_query_goals: "Key achievement off of level goals" level_completion: "关卡完成" pop_i18n: "填写 I18N" -# tasks: "Tasks" + tasks: "任务" article: edit_btn_preview: "预览" @@ -829,7 +829,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese # service_apple: "Apple" # service_web: "Web" # paid_on: "Paid On" -# service: "Service" + service: "服务" price: "价格" gems: "宝石" # active: "Active" @@ -934,7 +934,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese practices_title: "尊重最佳实践" practices_description: "这是我们对您的承诺,即玩家,尽管这在法律用语中略显不足。" privacy_title: "隐私" -# privacy_description: "We will not sell any of your personal information." + privacy_description: "我们不会泄露您的个人信息。" security_title: "安全" security_description: "我们竭力保证您的个人信息安全性。作为一个开源项目,任何人都可以检讨并改善我们自由开放的网站的安全性。" email_title: "电子邮件" @@ -1026,7 +1026,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese next_photo: "添加一张职业的照片(可选)。" next_active: "将自己标记为正在寻求工作机会以使自己的名字出现在搜索结果中。" example_blog: "你的博客" -# example_personal_site: "Personal Site" + example_personal_site: "个人主页" links_header: "个人网站链接" links_blurb: "链接任何你希望展示的网站或介绍,例如你的Github,你的领英档案,或是你的博客。" links_name: "链接名称" @@ -1088,7 +1088,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese education_description: "描述" education_description_help: "展示任何与你的教育经历相关的信息。(140个字符;选填)" our_notes: "我们的评注" -# remarks: "Remarks" + remarks: "评价" projects: "项目" projects_header: "添加3个项目" projects_header_2: "项目(前3个)" @@ -1101,7 +1101,7 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese project_picture_help: "上传一站230x115像素或更大的图片来展示这个项目。" project_link: "链接" project_link_help: "项目的链接。" -# player_code: "Player Code" + player_code: "玩家代码" employers: # deprecation_warning_title: "Sorry, CodeCombat is not recruiting right now." @@ -1165,6 +1165,6 @@ module.exports = nativeDescription: "简体中文", englishDescription: "Chinese av_other_sub_title: "其他" av_other_debug_base_url: "Base(用于调试 base.jade)" u_title: "用户列表" -# ucp_title: "User Code Problems" + ucp_title: "用户代码的问题" lg_title: "最新的游戏" clas: "贡献者许可协议" diff --git a/app/models/User.coffee b/app/models/User.coffee index 2f0779d9c..d05c49425 100644 --- a/app/models/User.coffee +++ b/app/models/User.coffee @@ -84,7 +84,7 @@ module.exports = class User extends CocoModel gemsEarned = @get('earned')?.gems ? 0 gemsPurchased = @get('purchased')?.gems ? 0 gemsSpent = @get('spent') ? 0 - gemsEarned + gemsPurchased - gemsSpent + Math.floor gemsEarned + gemsPurchased - gemsSpent heroes: -> heroes = (me.get('purchased')?.heroes ? []).concat([ThangType.heroes.captain, ThangType.heroes.knight]) @@ -139,7 +139,7 @@ module.exports = class User extends CocoModel else @subscribeCopyGroup = 'original' @subscribeCopyGroup - + getVideoTutorialStylesIndex: (numVideos=0)-> # A/B Testing video tutorial styles # Not a constant number of videos available (e.g. could be 0, 1, 3, or 4 currently) diff --git a/app/schemas/models/level.coffee b/app/schemas/models/level.coffee index 581fb4104..728261c64 100644 --- a/app/schemas/models/level.coffee +++ b/app/schemas/models/level.coffee @@ -34,7 +34,7 @@ defaultTasks = [ 'Write a loading tip, if needed.' 'Click the Populate i18n button.' - 'Mark whether it requires a subscription (after adventurer week).' + 'Mark whether it requires a subscription.' 'Release to everyone via MailChimp.' 'Check completion/engagement/problem analytics.' diff --git a/app/schemas/schemas.coffee b/app/schemas/schemas.coffee index f8c2873a4..c0fc4a075 100644 --- a/app/schemas/schemas.coffee +++ b/app/schemas/schemas.coffee @@ -227,7 +227,7 @@ me.RewardSchema = (descriptionFragment='earned by achievements') -> me.stringID(links: [{rel: 'db', href: '/db/thang.type/{($)}/version'}], title: 'Item ThangType', description: 'A reference to the earned item ThangType.', format: 'thang-type') levels: me.array {uniqueItems: true, description: "Levels #{descriptionFragment}."}, me.stringID(links: [{rel: 'db', href: '/db/level/{($)}/version'}], title: 'Level', description: 'A reference to the earned Level.', format: 'latest-version-original-reference') - gems: me.int {description: "Gems #{descriptionFragment}."} + gems: me.float {description: "Gems #{descriptionFragment}."} me.task = me.object {title: 'Task', description: 'A task to be completed', format: 'task', default: {name: 'TODO', complete: false}}, name: {title: 'Name', description: 'What must be done?', type: 'string'} diff --git a/app/templates/contribute/ambassador.jade b/app/templates/contribute/ambassador.jade index 346100849..294b77ea9 100644 --- a/app/templates/contribute/ambassador.jade +++ b/app/templates/contribute/ambassador.jade @@ -30,7 +30,7 @@ block content h4(data-i18n="contribute.how_to_join") How to Join p - a(title='Contact', tabindex=-1, data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="contribute.contact_us_url") + a(tabindex=-1, data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="contribute.contact_us_url") | Contact us span , span(data-i18n="contribute.ambassador_join_desc") diff --git a/app/templates/contribute/archmage.jade b/app/templates/contribute/archmage.jade index ad5728d63..200a2e454 100644 --- a/app/templates/contribute/archmage.jade +++ b/app/templates/contribute/archmage.jade @@ -41,13 +41,13 @@ block content p span(data-i18n="contribute.join_desc_1") | Anyone can help out! Just check out our - a(title='GitHub', href="https://github.com/codecombat/codecombat", tabindex=-1) + a(href="https://github.com/codecombat/codecombat", tabindex=-1) | GitHub span span(data-i18n="contribute.join_desc_2") | to get started, and check the box below to mark yourself as a brave Archmage and get the latest news by email. | Want to chat about what to do or how to get more deeply involved? - a(title='Contact', tabindex=-1, data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="contribute.join_url_email") + a(tabindex=-1, data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="contribute.join_url_email") | Email us span(data-i18n="contribute.join_desc_3") | , or find us in our diff --git a/app/templates/contribute/scribe.jade b/app/templates/contribute/scribe.jade index f6f73a779..432646ba0 100644 --- a/app/templates/contribute/scribe.jade +++ b/app/templates/contribute/scribe.jade @@ -36,7 +36,7 @@ block content h4(data-i18n="contribute.how_to_join") How To Join p - a(title='Contact', tabindex=-1, data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="contribute.contact_us_url") + a(tabindex=-1, data-toggle="coco-modal", data-target="core/ContactModal", data-i18n="contribute.contact_us_url") | Contact us span , span(data-i18n="contribute.scribe_join_description") diff --git a/app/templates/editor/campaign/campaign-level-view.jade b/app/templates/editor/campaign/campaign-level-view.jade index d991752af..ba52eb379 100644 --- a/app/templates/editor/campaign/campaign-level-view.jade +++ b/app/templates/editor/campaign/campaign-level-view.jade @@ -65,7 +65,7 @@ h4 Recent Sessions if recentSessions - div(style='font-size:10pt') Latest 10 sessions for this level + div(style='font-size:10pt') Latest #{recentSessions.length} sessions for this level div(style='font-size:10pt') Double-click row to open player and session table.table.table-bordered.table-condensed.table-hover(style='font-size:10pt') thead diff --git a/app/templates/editor/patches.jade b/app/templates/editor/patches.jade index d5e63bb00..080bcae49 100644 --- a/app/templates/editor/patches.jade +++ b/app/templates/editor/patches.jade @@ -1,15 +1,15 @@ .btn-group(data-toggle="buttons").status-buttons label.btn.btn-default.pending - input(type="radio", name="status", value="pending") + input(type="radio", name="status", value="pending", data-i18n="general.pending") | Pending label.btn.btn-default.accepted - input(type="radio", name="status", value="accepted") + input(type="radio", name="status", value="accepted", data-i18n="general.accepted") | Accepted label.btn.btn-default.rejected - input(type="radio", name="status", value="rejected") + input(type="radio", name="status", value="rejected", data-i18n="general.rejected") | Rejected label.btn.btn-default.withdrawn - input(type="radio", name="status", value="withdrawn") + input(type="radio", name="status", value="withdrawn", data-i18n="general.withdrawn") | Withdrawn if patches.loading diff --git a/app/views/editor/campaign/CampaignEditorView.coffee b/app/views/editor/campaign/CampaignEditorView.coffee index 71f434fb2..112dcd82d 100644 --- a/app/views/editor/campaign/CampaignEditorView.coffee +++ b/app/views/editor/campaign/CampaignEditorView.coffee @@ -243,9 +243,7 @@ module.exports = class CampaignEditorView extends RootView getCampaignCompletions: => # Fetch last 7 days of campaign drop-off rates - startDay = new Date() - startDay.setDate(startDay.getUTCDate() - 6) - startDay = startDay.getUTCFullYear() + '-' + (startDay.getUTCMonth() + 1) + '-' + startDay.getUTCDate() + startDay = utils.getUTCDay -6 success = (data) => return if @destroyed diff --git a/app/views/editor/campaign/CampaignLevelView.coffee b/app/views/editor/campaign/CampaignLevelView.coffee index 3771520d5..3283bd841 100644 --- a/app/views/editor/campaign/CampaignLevelView.coffee +++ b/app/views/editor/campaign/CampaignLevelView.coffee @@ -3,6 +3,7 @@ Level = require 'models/Level' LevelSession = require 'models/LevelSession' ModelModal = require 'views/modal/ModelModal' User = require 'models/User' +utils = require 'core/utils' module.exports = class CampaignLevelView extends CocoView id: 'campaign-level-view' @@ -47,9 +48,7 @@ module.exports = class CampaignLevelView extends CocoView getCommonLevelProblems: -> # Fetch last 30 days of common level problems - startDay = new Date() - startDay.setDate(startDay.getUTCDate() - 29) - startDay = startDay.getUTCFullYear() + '-' + (startDay.getUTCMonth() + 1) + '-' + startDay.getUTCDate() + startDay = utils.getUTCDay -29 success = (data) => return if @destroyed @@ -77,9 +76,7 @@ module.exports = class CampaignLevelView extends CocoView @levelCompletions = _.map data, mapFn, @ @render() - startDay = new Date() - startDay.setDate(startDay.getUTCDate() - 6) - startDay = startDay.getUTCFullYear() + '-' + (startDay.getUTCMonth() + 1) + '-' + startDay.getUTCDate() + startDay = utils.getUTCDay -6 # TODO: Why do we need this url dash? request = @supermodel.addRequestResource 'level_completions', { @@ -97,10 +94,8 @@ module.exports = class CampaignLevelView extends CocoView @levelPlaytimes = data.sort (a, b) -> if a.created < b.created then 1 else -1 @render() - startDay = new Date() - startDay.setDate(startDay.getUTCDate() - 6) - startDay = startDay.getUTCFullYear() + '-' + (startDay.getUTCMonth() + 1) + '-' + startDay.getUTCDate() - + startDay = utils.getUTCDay -6 + # TODO: Why do we need this url dash? request = @supermodel.addRequestResource 'playtime_averages', { url: '/db/level/-/playtime_averages' @@ -111,7 +106,7 @@ module.exports = class CampaignLevelView extends CocoView request.load() getRecentSessions: -> - limit = 10 + limit = 100 success = (data) => return if @destroyed diff --git a/app/views/play/level/modal/HeroVictoryModal.coffee b/app/views/play/level/modal/HeroVictoryModal.coffee index 2d11504c4..f473370a1 100644 --- a/app/views/play/level/modal/HeroVictoryModal.coffee +++ b/app/views/play/level/modal/HeroVictoryModal.coffee @@ -110,6 +110,8 @@ module.exports = class HeroVictoryModal extends ModalView # rewards = achievement.get('rewards') or {} # rewards.gems *= (index + 1) + # TODO: use earned achievement worths or somehow pull in recalculated exp/gems + c.thangTypes = @thangTypes c.me = me c.readyToRank = @level.get('type', true) is 'hero-ladder' and @session.readyToRank() diff --git a/scripts/analytics/mixpanelLevelRates.py b/scripts/analytics/mixpanelLevelRates.py new file mode 100644 index 000000000..2f26a2317 --- /dev/null +++ b/scripts/analytics/mixpanelLevelRates.py @@ -0,0 +1,82 @@ +# Calculate level completion rates via mixpanel export API + +# TODO: unique users +# TODO: align output +# TODO: order output + +import sys +from mixpanel import Mixpanel + +try: + import json +except ImportError: + import simplejson as json + +# NOTE: mixpanel dates are by day and inclusive +# E.g. '2014-12-08' is any date that day, up to 2014-12-09 12am + +if __name__ == '__main__': + if not len(sys.argv) is 3: + print "Script format: