我有很长的数据列表(例如说国家及其缩写)我想在HTML表格中显示.而不是在2 x 50表格中显示数据,我希望它对于更大的屏幕更紧凑(因此用户没有向上和向下滚动,但仍然不必水平滚动)
所以这会动态增长:
State | Ab ------------------- Alabama | AL Alaska | AK Arizona | AZ Arkansas | AR California | CA Colorado | CO Connecticut | CT
至:
State | Ab | State | Ab | -------------------------------------- Alabama | AL | California | CA | Alaska | AK | Colorado | CO | Arizona | AZ | Connecticut | CT | Arkansas | AR |
或这个:
State | Ab | State | Ab | State | Ab | …
我正在尝试发布仅我域用户的 Google Sheet Addon 以手动安装(不是所有用户的自动安装)
我已将 Google 表格中的代码提取到独立脚本中并尝试部署:
这会弹出一个 Chrome Store Listing 草稿;我填写:
我填写了很长的 Chrome 商品详情表单,但是当我发布时,我得到:
“在清单的 api_console_project_id 字段中没有指定 ID 的 API 控制台项目。”
我的理解是,如果您在 Google Script 编辑器 ( https://script.google.com ) 中编写代码,您不应该也不能修改项目的清单文件,因此不确定从哪里开始。
当我尝试对下面的类进行单元测试时,我得到以下舍入错误:
class TypeTotal
attr_reader :cr_amount, :dr_amount,
:cr_count, :dr_count
def initialize()
@cr_amount=Float(0); @dr_amount=Float(0)
@cr_count=0; @dr_count= 0
end
def increment(is_a_credit, amount, count=1)
case is_a_credit
when true
@cr_amount = Float(amount)+ Float(@cr_amount)
@cr_count += count
when false
@dr_amount = Float(amount)+ Float(@dr_amount)
@dr_count += count
end
end
end
Run Code Online (Sandbox Code Playgroud)
单元测试:
require_relative 'total_type'
require 'test/unit'
class TestTotalType < Test::Unit::TestCase
#rounding error
def test_increment_count()
t = TypeTotal.new()
t.increment(false, 22.22, 2)
t.increment(false, 7.31, 3)
assert_equal(t.dr_amount, 29.53)
end
end
Run Code Online (Sandbox Code Playgroud)
输出:
1) Failure:
test_increment_count(TestTotalType) [total_type_test.rb:10]:
<29.529999999999998> expected but was …Run Code Online (Sandbox Code Playgroud)